jquery - How to select deeply nested anchor for a click function -
i have structure
<dd class="treediv"> <ul> <li> <span class="title">title <a class="serieslink" href="link">hiv/aids project overview; program documents; aids prevention program files</a></span> </li> </ul> </dd> how can select anchor click function in jquery
you need use appropriate css selector @ it:
$( ".serieslink" ).on( "click", function() { console.log( $( ).text() ); }); it depends on if class "serieslink" specific enough want or can more specific giving id:
<a class="serieslink" href="link" id="myuniqueid"> and id query:
$("#myuniqueid") read best ways selectors here: jquery selectors page
Comments
Post a Comment