How can I select all options of multi-select select box on click?
For jQuery versions 1.6+ then
$('#select_all').click( function() {
$('#countries option').prop('selected', true);
});
Or for older versions:
$('#select_all').click( function() {
$('#countries option').attr('selected', 'selected');
});
LIVE DEMO
Try this:
$('#select_all').click(function() {
$('#countries option').prop('selected', true);
});
And here's a live demo.