javascript - If checkbox selected append his textValue into another span -


I have a dropdown check box for which I get the received checkbox value and append a When the checkbox is & lt; Input type = "text" class = "form-control" & gt; Checked after . When the checkbox is unchecked, I want to delete the add span.

This is what I have done:

  $ ('.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 ();}})   

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.

  // 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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -