html div onclick event

前端 未结 9 1059
渐次进展
渐次进展 2021-02-05 13:23

I have one html div on my jsp page, on that i have put one anchor tag, please find code below for that,

9条回答
  •  囚心锁ツ
    2021-02-05 13:57

    Try following :

    $('.expandable-panel-heading').click(function (e) {
            if(e.target.nodeName == 'A'){
                markActiveLink(e.target)
                return; 
            }else{
                alert('123');
            }
     });
    
    function markActiveLink(el) {   
        alert($(el).attr("id"));
    } 
    

    Here is the working demo : http://jsfiddle.net/JVrNc/4/

提交回复
热议问题