Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. how to toggle between textbox and textarea by jquery

how to toggle between textbox and textarea by jquery

Scheduled Pinned Locked Moved JavaScript
javascripthtmlsysadmindebuggingtutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mhd sbt
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups