Why is this JQuery function not working in FF?

The following JQuery function doesn't work completely. IE 7 handles both warnings, but FF 3.0.10 only fires the first warning. What I did wrong?

function submitClick() {
    var submitButton = '#<%=SubmitButton.ClientID%>';
    alert('got here');

    $(submitButton).click(function() {
        alert('got here too');
        $.blockUI({ message: $('#process-message') });
    });
}

      

Also, I called alert ($ (submitButton)); and this returns "Object Object" in FF.

0


a source to share


1 answer


You don't seem to do what you think you think.

What you are actually doing is the submitClick () method, which you add to the click event handler to the button. But you don't call that handler. This will not happen until you actually press the button.



Are you trying to programmatically press this button? If so, you don't. This will click the button:

function submitClick() {
    var submitButton = '#<%=SubmitButton.ClientID%>';
    alert('got here');

    $(submitButton).click();
    alert('got here too');
    $.blockUI({ message: $('#process-message') });
}

      

+2


a source







All Articles