Although other browsers seems fine, IE7 is not friendly with my 10 lines javascript.
All the (small) code can be found here : http://jsfiddle.net/7nGd9/
$(function() {
$('#prepareSpecificProgressModal')
.each(function(index, modal) {
var
modal = $(modal),
form = $('#myform');
form.on('change', 'select', function(){
var node = $(this);
node
.closest('form')
.find('select').not(this)
.each(function(i, element){
element.selectedIndex = -1;
});
});
});
});
I’m using $(element).val(''); to reset the selection of option but it’s not working under IE7. Basically it allows multiple selection across the 3 select even if there are JS supposed to prevent it.
Thanks for any advices.
Try
to unselect all options (Demo). Or, instead of the
eachloop, you can use.prop("selectedIndex", -1)equivalently (would have worked with.val(''), too).Btw, according to the docs of
.val(), you can pass an array of the options to select (ornullinstead of the empty array):(Demo)