jQuery; combine user click and :checked

Posted by user275074 on Stack Overflow See other posts from Stack Overflow or by user275074
Published on 2010-04-12T10:05:14Z Indexed on 2010/04/12 10:13 UTC
Read the original article Hit count: 305

Filed under:
|
|
|

I have two blocks of code which basically check for 1) a click event on a radio button e.g.

$("input[id='frmSkill']").click(function(){ 
      //do something
});

And 2) a block of code to check if a radio button is :checked, if so, then perform some actions e.g.

if($("input[id='frmSkill']:checked").val()){
      //do something
});

What I'd like to do is combine the two in order to reduce the code as the actions performed under each are the same.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about checked