get value by id in jquery 1

get value by id in jquery

$(this).attr('id')

Here is what the above code is Doing:
1. We’re using the .on() method to attach an event handler to the document.
2. We’re using the .click() method to specify that we want to handle the click event.
3. We’re using the .attr() method to get the id attribute of the element that was clicked.
4. We’re using the .attr() method to set the id attribute of the element that was clicked.

Similar Posts