pranky64
pranky64

Reputation: 415

Jquery : Checkbox not getting checked in IE7

I'm trying to check a checkbox, i've tried doing the following :-

  1. $('#someId').attr('checked','checked');

  2. $('#someId').attr('checked', true);

both the above work for ie8,ff but not for ie7!!

I'm using an older version of jquery (1.4.2) so using .prop() is not possible.

Upvotes: 0

Views: 867

Answers (1)

Bas Slagter
Bas Slagter

Reputation: 9929

You can always go the native Javascript way:

// Get element using jQuery
var myCheckbox = $('#someId').get(0);

// Make it checked old school style.
myCheckbox.checked = true;

Edit:

Of course: document.getElementById("someId") will get you the element totally jQuery independend

Upvotes: 4

Related Questions