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 3 of 3
  1. #1
    New Coder
    Join Date
    May 2013
    Posts
    40
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Help with jquery posting values from form

    I cant seem to figure out how to get jquery to take the form values that a user typed in and post it into the html. I am pretty new in jquery, but could not find any info on google.

    here is how my form looks
    Code:
    <form name="myForm" action="signUP.html" method="post" onsubmit="return validateForm()">
    
    <fieldset>
    <legend>Enter basic info about yourself</legend>
    
        
    <ul>
    <li><label for = "uName">Type in user name:</label> <input type="text" name="uName" placeholder = "user name" id="uName" required></li>
    <li><label for = "email">Email Address:</label><input type="email" name="email" placeholder = "email" id="email" required></li>
    </ul>
    </fieldset>


    Would the jquery be something like this?

    Code:
    <script>
    $(document).ready(function(){
      $('.submit').click(function(){
            var names = $('#uName').val(); 
            $('p').append($(name));
        
    });
        
        
        
    });    
        
        Thanks
        
    </script>

  • #2
    New Coder
    Join Date
    Jan 2013
    Location
    Sunnyvale, CA
    Posts
    98
    Thanks
    6
    Thanked 7 Times in 7 Posts
    Your post indicates that you are not quite familiar with HTML and JavaScript, so you might want to start with HTML, continue with CSS, and then learn JavaScript. jQuery should not be touched until these three prerequisites are mastered!

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Code:
    $(document).ready(function(){
      $('form').submit(function(e){  //
    e.preventDefault() // prevent normal form submittal
            var names = $('#uName').val(); 
            $('p').append($(name));
        
    });
    });

  • Users who have thanked DanInMa for this post:

    cpamieta (08-04-2013)


  •  

    Posting Permissions

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