www.webdeveloper.com
Results 1 to 2 of 2

Thread: Remove form element via href link

  1. #1
    Join Date
    Dec 2008
    Posts
    9

    Remove form element via href link

    The code below ADDS a new EMAIL field to the form via an href link. Can someone here modify the code to REMOVE an EMAIL field? or point me in the right direction?

    Thanks,

    Frank

    Code:
    <SCRIPT type=text/javascript>
      function add_email()
      {
        var div1 = document.createElement('div');
    
        // Get template data
        div1.innerHTML = document.getElementById('newemailtpl').innerHTML;
    
        // append to our form, so that template data become part of form
        document.getElementById('newemail').appendChild(div1);
      }
    </SCRIPT>
    
    <DIV id=newemail>
     <DIV class=email>
      <INPUT id=email_address_ type=text name=email_address[]> 
     </DIV>
    </DIV>
    
    <P id=addnew>
     <A href="javascript:add_email()">Add New</A> 
    </P>
    
    <DIV style="DISPLAY: none" id=newemailtpl>
     <DIV class=email>
      <INPUT id=email_address_ type=text name=email_address[]> 
     </DIV>
    </DIV>

  2. #2
    Join Date
    Jul 2010
    Posts
    7
    maybe display:none?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles