0

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>
Prisy
  • 90
  • 11

4 Answers4

0

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".

Community
  • 1
  • 1
Anant Dabhi
  • 10,864
  • 3
  • 31
  • 49
  • Hey the lines you gave is working fine disabling it... but I am able to click it :( and hence the form is getting submitted in ie 9. – Prisy Mar 27 '14 at 05:19
0

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

Quincy
  • 4,393
  • 3
  • 26
  • 40
0

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

$('form').submit(function(e) {
    if ($('#deleteclientajaxformlink').prop('disabled')) {
        e.preventDefault();
    }
});
Jason P
  • 26,984
  • 3
  • 31
  • 45
0

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

$('#deleteclientajaxformlink').addClass('ui-state-disabled');
xdetector
  • 31
  • 4
  • While it's great that you've provided an alternate solution to the problem at hand, keep in mind that this question already had an accepted answer more than 2 years ago, so try to avoid reviving dead questions unless there is a notably better way of tackling the problem raised :) – Obsidian Age Jan 20 '17 at 03:26
  • But the accepted answer doesn't work, so I think my solution maybe useful for somebody else. – xdetector Jan 20 '17 at 06:32