Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to replace listbox by text box dynamically

    When I click Button in html page, the list box should be replaced by text box.
    How to do this by using Javascript. Please help me

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,026
    Thanks
    36
    Thanked 494 Times in 488 Posts

    Lightbulb Consider this ...

    Will this work for you?
    PHP Code:
    <html>
    <
    head>
    <
    title>Listbox Textbox swap</title>
    <
    script type="text/javascript">
    function 
    Swapper() {
      var 
    elem document.getElementById('dLbox');
      if (
    elem.style.display == 'block') {
        
    elem.style.display 'none';
        
    document.getElementById('dTbox').style.display 'block';
      } else {
        
    elem.style.display 'block';
        
    document.getElementById('dTbox').style.display 'none';
      }
    }
    </script>
    </head>
    <body>
    <h1> Listbox - Textbox swap</h1>
    <div id="dLbox" style="display:block">
     <select id="Lbox">
      <option value="0">0</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
     </select>
    </div>
    <div id="dTbox" style="display:none">
     <input type="text" id="Tbox" value="">
    </div>
    <button onclick="Swapper()">Swap</button>
    </body>
    </html> 

  • #3
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have fields

    Categories Listbox
    Product Textbox
    I have two buttons submit,Save
    when I click this Save this Listbox should be replaced by textbox
    Please help me how to change.

  • #4
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank You for your help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •