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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -