Kamil
Kamil

Reputation: 892

"onclick" button in html form not working

<input type="button" 
               value="Register" 
               onclick="return regformhash(this.form,
                               this.form.username,
                               this.form.email,
                               this.form.password,
                               this.form.confirmpwd);" /> 

When i try to click on that its like no reaction. Just trying to add informations from form, to my php script.

Upvotes: 0

Views: 182

Answers (1)

Nitin Dhomse
Nitin Dhomse

Reputation: 2602

The following is working snippet with your example for username field, add your other input fields and pass those to function.

function regformhash(form, username){
            alert("username:  "+username);

           }
          
<form>
  <input type="text" value= "myUserName" name ="username"/>
  <input type="button" value="Register" onclick=" regformhash(this.form,this.form.username.value);"/> 
          
</form>
          
          
  
          

Upvotes: 1

Related Questions