i'm trying to change the value of an text input to no if checked or yes if not checked, this with a checkbox but i cant seem to get it working..
<input type="checkbox" name="checkbox" id="checkbox" value="" />
<input type="text" name="text" id="text" value="" />
$(function(){
$('#checkbox').change(function() {
$("#text").val(($(this).is(':checked')) ? "yes" : "no");
});
});
Demo: http://jsfiddle.net/YJRQp/
is there something i miss here? please advise.
jQUery.http://jsfiddle.net/YJRQp/1/