Try return false;
from within the if statement.
if(pass1.value != pass2.value)
{
alert("don't match");
return false; // Abort
}
Also as @Lloyd said, check for values, not elements.
More Related Contents:
- Error tells me I need JavaScript
- Javascript Commenting not working. Cannot comment out a comment?
- Render HTML to an image
- Cross-platform, cross-browser way to play sound from Javascript? [duplicate]
- Get the value of checked checkbox?
- Check if all values of array are equal
- How to detect escape key press with pure JS or jQuery?
- How to trigger jQuery change event in code
- Download image with JavaScript
- adding css file with jquery
- Javascript: Converting String to Number?
- Partitioning in JavaScript [duplicate]
- Convert RGB to RGBA over white
- Getting value GET OR POST variable using JavaScript?
- Filter strings in Array based on content (filter search value)
- difference between offsetHeight and clientHeight
- Cross Domain Resource Sharing GET: ‘refused to get unsafe header “etag”‘ from Response
- How best to determine if an argument is not sent to the JavaScript function
- Proper way to reset a GIF animation with display:none on Chrome
- Javascript Marquee to replace tags
- Align Marker on node edges D3 Force Layout
- Using local file as src
- Is document.write actually deprecated?
- Clear dropdown using jQuery Select2
- Passing JSON data from php to html-data attribute and then to Javascript
- How to fire jQuery function only if form is valid
- Mongoose schema within schema
- How to create a sleep/delay in nodejs that is Blocking?
- How do I listen for triple clicks in JavaScript?
- WebSocket: How to automatically reconnect after it dies