Selecting DOM elements by text with JavaScript

A custom JavaScript solution for selecting DOM elements by the some specified text they contain.

Advertisements

How to effectively attach eventListeners to DOM elements

Anonymous functions are great way to quickly get the job done, but can be a huge problem when used carelessly. It is especially when attaching eventListeners to DOM elements. Take the code below for example. Here we are attaching an eventListner to the element for the "click" event. Now, later lets say for some reason … Continue reading How to effectively attach eventListeners to DOM elements

Constants in ECMA Script 6 and their implementations

Web browsers have already started providing ECMA Script 6 functionalities to the users, BUT  before utilizing these features there are few anomalies in the implementations in different web browsers, and one of them is constant. Constants were among the most awaited features in JavaScript. Below is a brief look at constants and their behavior in different browsers. … Continue reading Constants in ECMA Script 6 and their implementations

JavaScript Programmer ? Do you also ignore semicolon?

A little story of two JS Programmers ==> Alice and Bob Bob: Hey Alice. You know what, I have learned JavaScript very well. It's very easy and fun. Alice: Good, but you still need to be careful while writing you JS program. Bob: Are you kidding me ? Careful with JavaScript? Several times I escape putting … Continue reading JavaScript Programmer ? Do you also ignore semicolon?

Better use of Memoization JavaScript

Referring to the post Generating Unique Strings (Ids) in JavaScript where we looked at how to generate unique strings in JavaScript. Also I mentioned the performance and memory issues with the approach. So, here we are going to look a much better use or application of Memoization, but we won't be using it for generating unique strings. We will be … Continue reading Better use of Memoization JavaScript

Generating Unique Strings (Ids) in JavaScript

Well, there are tools in JavaScript that allow you to create unique ids or strings. I will be using to two ideas to create these unique strings. Method 1: Memoization The idea is to generate some random string and checking if it has already been generated the recursively generate another one and test again. If … Continue reading Generating Unique Strings (Ids) in JavaScript