javascript - If checkbox selected append his textValue into another span -
I have a dropdown check box for which I get the This is what I have done: This is not my script being too great because if I use more checkboxes If you select the option then remove it once for every checked element and only when I uncheck the last checkbox. received checkbox value and
append a
& lt; Input type = "text" class = "form-control" & gt; Checked after . When the checkbox is unchecked, I want to delete the add span.
$ ('.chkb: checkbox'). Click (function () (If ($ (". Chkb"), prop ('checked') == true) {var textName = $ ('. Chkb: checked'). Next ('.txt') .text (); $ ("Input-append") .append ('& lt; span class = "input-group-addon vss" & gt;' + textName + ''); / / Warning (textName);} and {$ (". VSS") .remove ();}})
// dropdown menu (but 'click', function (e) {if ($ (this) .hasClass ('drop-down-stay')) Find the span name of the {e.stopPropagation ();}}) // check box and enter in the add span $ ('.chkb: checkbox'). (function () {if ($ (this) .prop ( 'checked')) {var textName = $ (this) Next ('.txt') .text (); $ (".input-append") .append ('& lt; span class = "input-group-adon Vss "& gt; '+ textName +' & lt; / Span & gt; '); // warning (textName);} and {// re-checking $ (".vss") .remove (); $ ('.chkb: checkbox: check'). Every (function () {$ (".input-append") .append ('& lt; span class = "input-group-addon vss">' + $ (this) .next ('.txt') .text () + '& lt; / span & gt;');});}})
Comments
Post a Comment