I am chaging the text of a textbox, and its upating a label, but its hiding the checkbox? Can any one tell me what am I doing wrong?
Here
Here
<input type="text" id="txtInput" width="80px" />
</br>
<label id="lbl" />
</br>
</br>
<input type="checkbox" id="chkUpdate" />
The jQuery
$(document).ready(function(event) {
$('#txtInput').keydown(function(event) {
$('#lbl').text($('#txtInput').val());
$('#lbl').change();
});
$('#lbl').change(function(event) {
// alert($('#chkUpdate').size());
$('#chkUpdate').change();
});
});
Okay, I closed the label tag it's still not working... Check the updated fiddle.
EDIT 2 Okay its working now, but I am not getting what I wanna do, as should be clear from the code, I want to check
uncheck
(basically change) the checkbox, when the label is updated, but as you can see in the fiddle(s) (mine and the one Muthu Kumaran provided) the checkbox is not changing its state?
EDIT 3 : This seems to work with click()
instead of change()
, but as per jQuery specification, shouldn't it work with change too??