Attach Event to Dynamically Created Elements with jQuery

Once the web page is being fully loaded, then the same event handler is not being attached to newly created elements.

It seems like the event handler is being attached conceptually.

When you perform some action on new elements, then the event bind with it not trigger on the new element. But it is working on the elements which are created during the webpage loading.

This problem is common if the event handlers are not correctly attached.

Attach Event to Dynamically Created Elements with jQuery

Read more

Prevent page from submit on Refresh in PHP

If the form is already submitted and the user tries to refresh the webpage then the browser will attempt to resubmit the form.

If you are allowing the user to fill and submit the form for insert data. In this case, if the user refreshes the page then the data is reinserted into the MySQL database table if some action does not perform for preventing it.

In this tutorial, I show you some ways by using which you can avoid the page resubmit.

Prevent page from submit on Refresh in PHP

Read more

.addClass() and .removeClass() methods in jQuery

In jQuery, there are various methods like – switchClass(), toggleClass(), addClass() and removeClass() by using them you can easily add or removes classes in the elements.

For using switchClass() method you need to include jQuery UI library within your page but you can simply use toggleClass(), addClass() and removeClass() without any dependency other than jQuery.

In this tutorial, I discuss about addClass() and removeClass() method.

.addClass() and .removeClass() methods in jQuery

Read more