Skip to content Skip to sidebar Skip to footer

Performing Click Event On A Disabled Element? Javascript Jquery

I would like to perform the click event of a element: jQuery('input#submit').click(function() { if ( jQuery('input#submit').attr('disabled') ) { alert('SUP');

Solution 1:

Why would you want the click event to work for the disabled button? Your best bet would be to keep the button enabled, but only have it 'work' if some other condition is met, by preventing the button from causing a submit by returning false. E.g.:

jQuery('input#submit').click(function(e) {
        if ( something ) {        
            return false;
        } 
});

Post a Comment for "Performing Click Event On A Disabled Element? Javascript Jquery"