Users Pricing

forum

home / developersection / forums / how to get the id of the element clicked using jquery?

How to get the id of the element clicked using jQuery?

Anand Pandey 1946 06 Jun 2017
<div class="main_div">
    <div id="inner_div">   
        <span id="d1" class="get_clicked">click to get id</span>
    </div>
</div>

 

 

How to get the id of the clicked element? 

The span which is present inside the inner_div will be having different ids because I will be loading the span from the model(MVC) using jquery ajax. So there will be 'n' number of span. All the span will have unique id. I want to get the id of the span which I click.

How to get the id of the span when clicked? How to do this using jQuery?


Anand Pandey

Other


2 Answers