javascript - How can I appendChild to a text field? -


i trying create text field takes user input , creates tag if valid email id.

i using appendchild() method append tags after creating them unable so.

below code append <span> field:

html

<textarea id="customfield" class="mdl-textfield__input" type="text" rows="1"></textarea> 

js

document.getelementbyid("customfield").appendchild(spanparent); 

i not sure right way this, great if can help.

you cannot use appendchild() input field, instead, use container of input field, see live action here: https://jsfiddle.net/37b2fa2e/2/.

you should consider using insertbefore() method, helps inserting specified node before reference node child of current node.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -