Search

Sunday, August 31, 2008

Check box with Jquery

checkbox are to used when you want to let the visitor select one or more options. If I want to alert value of checkbox when I selected it. This code here to show below are to show alert box.
I using jquery.
 <input>="radio" name="rdio" value="a" checked="checked" />
<input>="radio" name="rdio" value="b" />
<input>="radio" name="rdio" value="c" />

$("input[@name='rdio']").change(function(){
if ($("input[@name='rdio']:checked").val() == 'a')
// Code for handling value 'a'
else if ($("input[@name='rdio']:checked").val() == 'b')
// Code for handling value 'b'
else
// Code for handling 'c'
});

source:http://www.techiegyan.com

No comments: