how to toggle between textbox and textarea by jquery
JavaScript
1
Posts
1
Posters
0
Views
1
Watching
-
hi to all i written some code for toggle between textbox and textare but when my textbox convert to multi line(textarea) it cant be convert to input text again how can i do this my html:
<form id="form1" runat="server">
</form>
$(function () {
$(':input').click(function () {
var newTextArea = document.createElement('TextArea');
this.parentElement.appendChild(newTextArea);
debugger
newTextArea.name = $(this)[0].id;
newTextArea.value = $(this)[0].defaultValue;
newTextArea.onclick = function () {
var newtext = document.createElement('input');
newtext.value = this.innerText;
newtext.name = this.name;
this.parentElement.appendChild(newtext);
$(this).remove();
}
$(this).remove();
})
});thanks in advance