Question

The button is given to be disabled. but it is still clickable in ie 9.

Working fine in ie 7.

$(document).ready(function() {
$('#deleteclientajaxformlink').attr('disabled', true);
});

What can be the issue??? Any ways to disable from clicking?

struts2:

<sj:a id="deleteclientajaxformlink" formIds="deleteclientform"
targets="deleteclientformResult" button="true"
indicator="deleteclientsubmitindicator">Delete</sj:a>
Was it helpful?

Solution

If you are using jQuery < 1.6, do this:

  $('#deleteclientajaxformlink').attr("disabled", 'disabled');

If you are using jQuery 1.6+:

  $('#deleteclientajaxformlink').prop("disabled", true);

See this question: .prop() vs .attr() for references "why".

OTHER TIPS

Why not just use the <sj:a> tag disabled attribute

   <sj:a id="deleteclientajaxformlink" formIds="deleteclientform"
    targets="deleteclientformResult" button="true"
    indicator="deleteclientsubmitindicator" disabled="true">Delete</sj:a>

https://code.google.com/p/struts2-jquery/wiki/AnchorTag

You could try checking the state of the button in the form submit event:

$('form').submit(function(e) {
    if ($('#deleteclientajaxformlink').prop('disabled')) {
        e.preventDefault();
    }
});

I tried all above solutions, but they don't work. And here is my solution:

$('#deleteclientajaxformlink').addClass('ui-state-disabled');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top