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 Pandey164006-Jun-2017
<divclass="main_div">
    <divid="inner_div">   
        <spanid="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?


Updated on 14-Jun-2017

Can you answer this question?


Answer

2 Answers

Liked By