jquery - change input text field into label with input typed value inside label javascript -


i want change text field label tag input user typed text inside it. have tried , seen many example working not set value text in label. e.g.:

<input id="1" type="text" value="hi"/> 

i want replace input text field label or div tag innerhtml hi or user typed value have tried example below not done me.

<p id="1" onclick="wish(id)">sasdsad</p> <script>         document.getelementbyid("1").outerhtml = document.getelementbyid("1").outerhtml.replace(/p/g,"div"); </scrip> 

element id should start character not number.

with using jquery

<input id="one" type="text" value="hi"/>  $('#one').replacewith("<div>"+$('#one').val()+"</div>"); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -