2

Button inside the disabled div is working in chrome. In Firefox its not working.

$(".div_class").attr('disabled', 'disabled');

someone will have experience in it. please give your suggestions.

thanks

Hi all, Here the solution for this quetion

$(".div_class).find('input,textarea,select,button').attr('disabled', 'disabled');
Ramesh
  • 347
  • 3
  • 11
  • You said you have a button, why don't you just disable the button instead of the `div`? – Steven V Jun 11 '13 at 14:14
  • @karthikr, for me div is disabled but the button is till working. this problem is only in chrome. in firefox its fine – Ramesh Jun 11 '13 at 15:06

2 Answers2

1

Use .prop( propertyName, value ) instead of .attr( attributeName, value )

Also disable button not .div_class:

$(".div_class button").prop("disabled", true);
Shaddow
  • 3,175
  • 3
  • 22
  • 42
  • aaah its div, ... I EDIT – Shaddow Jun 11 '13 at 14:16
  • please explain why, IE after jQuery 1.6 attr is no longer the same and prop was added....blah blah blah – abc123 Jun 11 '13 at 14:18
  • all informations about difference between _attributes_ and _properties_ you can find here - http://api.jquery.com/prop/ – Shaddow Jun 11 '13 at 14:22
  • I meant to add it to your answer no the comments...This is the correct answer but seriously without context the next person to come to here is just going to get the solution without the why it fixes it...hardly teaching them anything. – abc123 Jun 11 '13 at 15:34
  • OK I improved answer :) – Shaddow Jun 11 '13 at 15:40
0

As per Docs It didn't make any sense that disabling a div as there is no attribute or property called disabled for a div element.forget about div disable the button

$('#buttonselector').prop("disabled", true);
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • thanks, i had repeated the div with unique id. every div will have separate disable button. also i'm not having only button in it. i have some other data also in it. – Ramesh Jun 11 '13 at 14:50