s

how to check the type of element in jquery edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 16 September 2020 | 2299

In the javascript code, I wanted to update the src if the selected element is an Image. Check the jquery / javascript code below to find the type of element.

$(".classname")[0].tagName
or 
$("#yourid")[0].tagName

The above code returns IMG if the selected element is an image