Dynamically add and remove element with jQuery

In this post, I show how you can add and remove new elements within your web page with jQuery.

There are two approaches to doing this –

  • Pre-made all elements
  • Dynamically create a new element

The first case is easy but you have to create all of the elements at once and hide them which is not required currently.

When you have to add an element you need to display the element one by one and for removing hide them.

Here the problem is – there are multiple unused elements are available which occupy space within your code and make it messy even if you don’t have needed some of the elements.

The second solution is better than the first where you can create and remove an element dynamically when you have to require.

In this tutorial, I am using the second solution.

Dynamically add and remove element with jQuery

Read more

Blur effect on the element via Foggy jQuery Plugin

Some website owners Blur some parts of the content and ask the user to register to their website or share the article for full access to the content.

Blur effect can be used for better user-experience for example – showing container elements when mouse focus over it and Blur other containers.

For the blur effect, I am using the Foggy jQuery plugin. It is lightweight and easy to set up.

In this tutorial, I show how you can use the Foggy jQuery plugin to blur the HTML content on mouse hover.

Blur effect on the element via Foggy jQuery Plugin

Read more

How to Use jQuery Each to Iterate Through Arrays Objects and Selectors

jQuery revolutionized web development with its simplicity and powerful features. Among them is the “jquery foreach” loop, enabled by the `$.each()` method.

This article explores how this method efficiently iterates through arrays, objects, and selectors. Gone are the days of cumbersome loops and complex constructs. With the “jquery foreach” loop, you can effortlessly navigate collections, significantly reducing development time.

Whether you’re a seasoned developer or a beginner, this article equips you with the knowledge to master the `$.each()` method and unleash its full potential.

Let’s dive into the world of jQuery iteration and elevate your web development skills with the “jquery foreach” loop.

How to Use jQuery Each to Iterate Through Arrays Objects and Selectors

Read more

Show and Hide Password Field Text with jQuery and JavaScript

Password field by default doesn’t show any visible text other than the symbol.

Some websites allow the user to view the hidden text in the password field by toggling.

For this, they provide an element e.g. checkbox or a button when it gets clicked then the password element value is been visible on the screen and reset to default view when it again gets clicked.

In this tutorial, I show how you can implement this functionality with jQuery and JavaScript.

Show and Hide Password Field Text with jQuery and JavaScript

Read more