Have you ever had to access a parent node from a given child node? In this example, we are going to traverse up the DOM tree starting from the button to look for the parent node with the name attribute itsMe.
Tag Archives: onclick event
How to create your own customized calculator via JavaScript
This is a simple example of implementing a calculator with JavaScript and HTML. This calculator will only have the division, multiplication, addition, and subtraction operators but you can easily tack on more functions if needed.
How to validate email format via JavaScript
This JavaScript demo verifies that an email address is in the correct format and that the user has typed in the same address in both fields to prevent mistyping of the address. I have borrowed the regex for verifying the correct email format from a different site.
How to dynamically remove/delete elements via JavaScript
This post is in response to one of the comments on have received regarding the removal of elements via JavaScript. I have taken the original function posted and edited it a little bit for the demo.
How to find and replace text dynamically via JavaScript
This is a neat little script that demonstrates two things:
1) Find – If only the Find box is filled in, then the findMyText() JavaScript function will just perform a find for the div that is given. If there is a match, the text will be highlighted and marked in bold.
2) Find and Replace – If both the Find and Replace boxes are filled in, then the findMyText() JavaScript function will do just that.