I have a textbox, which upon a change in text, calls some Javascript.
Before this textbox, I have 2 checkboxes (chkA, chkB) which are mutually exclusive.
When I start my new function I want to be able to check which checkbox is currently selected. So far I have this,
$(".textbox1").keyup(function () {
var chk = $(this).prevAll(":checked").first().attr('class'); ....
});
The code goes on to do a “If class = blah, then do something, else, do nothing”
it worked for my radio button code, but not my checkboxes. “chk” ends up being null.
If you need to know the class of a checked checkbox (i used an imaginary element that i called “wrapper” which holds all your input fields, substitute that with the correct element or post your markup):