I am trying to display(block,none) select boxes(in this example only one select box) through a jquery command. But I am getting no results. I have this working with a hidden attribute but I need this work with a display(block, none).
Non-working JS/JQUERY with display(none,block)
var formObject = {
run : function(obj) {
obj.nextAll('.update').attr({'disabled': true, 'none':true}).html('<option value="">----</option>');
var id = obj.attr('id');
var v = obj.val();
jQuery.getJSON('includes/update.php', { id : id, value : v }, function(data) {
if (!data.error) {
obj.next('.update').html(data.list).removeAttr('disabled none');
} else {
obj.nextAll('.update').attr({'disabled': true, 'none':true}).html('<option value="">----</option>');
}
});
}
};
Don’t use attributes for hidding elements!!!
jQuery:
CSS:
Vanilla javascript: