Get the id of a the item that is clicked

前端 未结 10 1871
执念已碎
执念已碎 2020-12-11 09:26

I have this html code:

FOO
FOO2


        
10条回答
  •  情书的邮戳
    2020-12-11 10:00

    Try with this:

    $('b.edit').click(function(e){ //When you use an event is better
                                   //send the event variable to the 
                                   //binding function.
        var id = e.target.id; //get the id of the clicked element.
       /*do your stuff*/
        $('.editP').focus();
    });
    

提交回复
热议问题