I have a text area form like this one:
<input id="sg_0" name="sjalfgefid" type="text" class="letur hvitur" size="8" maxlength="40" value=""></td>
and a Checkbox next to it:
<input type="Checkbox" id="cb0" name="innsent" tegund="val" gildi="eink" value="0" number="0" parents="1" onclick="hakaVid(this)">
I want the checkbox to be filled when some text is written in the text area. And when the user deletes all the text from the textbox, I want the checkbox to update immediately
How can I possibly do this ?
Attach an
onKeyUpevent handler to the<input>and modify the checkbox’s value according tothis.value.length.Example: http://jsfiddle.net/qG5Cu/
UPDATE You might be interested on using the
onInputevent handler instead ofonkeyup. See this link for more information: Using the oninput event handler with onkeyup/onkeydown as its fallback