lundi 6 mars 2017

jquery 1.4.2 and chrome.. detecting a check box is checked....How?

So for reasons beyond my control, I'm using jquery 1.4.2 and chrome..

I'm having a ludicrous amount of trouble trying to get detecting a check box is checked....working...

Here is what I have...

HTMl generated by Mvc3

<input type="checkbox" name="criteriaVm.WasApproved" id="criteriaVm.WasApproved">

Various versions I've tried

            var ob = $("#criteriaVm.WasApproved");// is valid
            var chk = ob.attr('checked'); // undefined
            //chk = ob.prop('checked');//crash
            //chk = ob.get(0).checked;//crash
            //chk = ob.get(0).is(":checked");//crash

I've tried others before I started keeping track to make sure I wasn't just going in circles...

Does anyone know what version works on the old school jquery i'm, stuck with?

Aucun commentaire:

Enregistrer un commentaire