Monthly Archive: May 2020

Detect tag removed using jQuery

Problem: Want to detect a tag like <div>, when it removed, do something.

Solution: Based on this answer, we can use on’ to detect event like‘remove’:

keep in mind that you must add jQuery (v1.9.1 or above) and jQuery UI -(v1.10.2 or above) scripts in it.

For example, I want to detect a tag with class name “test”:

<div class="test">already to vanish</div>

in the jQuery script part, add below code:

$(".test").on("remove", function () {
    alert("Element was removed, do something");

Form submit not working due to hidden required field

Problem: As the title stated, the form submit function not working because of the required field that user forgot to fill, and the field itself is hidden like below code:

<input type="hidden" required name="form_field"  >

so the solution will be adding the value into that hidden value.