You need to add preventDefault()
to your click handler. This will stop the browser executing it’s own link handler, and will only run the code you specify.
Example:
$("#myID").click(function(e) {
e.preventDefault();
// Do your stuff
});
More Related Contents:
- Get one element title and add this to another div in jquery
- how do i submit message to my email by html or js?
- JS hide function error
- Get the longest text in HTML document using Jquery or javascript
- Hide/Show image on one click [closed]
- How to create button to check uncheckable checkbox
- How to move an element into another element?
- JSFiddle code not working in my own page
- How to prevent a click on a ‘#’ link from jumping to top of page?
- How to calculate the XPath position of an element using Javascript?
- How to disable scroll without hiding it?
- Uncaught Error: SECURITY_ERR: DOM Exception 18 when I try to set a cookie
- jQuery: Get selected element tag name
- Why does Jquery only affect the first div element? [duplicate]
- HTML anchor link – href and onclick both?
- Set date in input type date
- document.getElementsByClassName().innerHTML always returns “undefined”
- jquery select option click handler
- jQuery jump or scroll to certain position, div or target on the page from button onclick [duplicate]
- Save a pre element as PDF with CSS
- How To Show And Hide Input Fields Based On Radio Button Selection
- jQuery Validation using the class instead of the name value
- Center flex item in container, when surrounded by other flex items
- Onclick reload the div only
- jQuery: How to listen for DOM changes?
- submit event does not fire if submit initiated programmatically
- How can I remove wrapper (parent element) without removing the child?
- How to Bootstrap navbar static to fixed on scroll?
- How to highlight a part part of an Input text field in HTML using Javascript or JQuery
- Test if an element can contain text