I have number of checkbox elements are there in my html page
<input type='checkbox' class='txtshow'checked="checked\" id='someid1' name='checkMr[]' value='some value' >
<input type='checkbox' class='txtshow'checked="checked\" id='someid2' name='checkMr[]' value='some value' >
<input type='checkbox' class='txtshow'checked="checked\" id='someid3' name='checkMr[]' value='some value' >
- what i want is whenever any of this is checked dynamically one element input type=’checkbox’ should be added to html page.
- if unchecked then remove the element which was added.
- same element should no be repeated.
On the click event, check if the checkbox is checked. If it is, then add a checkbox, if it is not checked, then remove the checkbox. Use an id related to the parent to link them together:
Fiddle:
http://jsfiddle.net/nyZj6/6/