jQuery select parent -
this might duplicate question, did search , got many different answers don't know use or how this.
<? if(isset($content)) { $i = 1; foreach($content $item) { echo "<li><a href='#' name='" . $item['id'] . "'>" . $item['title'] . "</a></li>"; $i++; } } ?> i've added function these links jquery handle ajax call. select links follows:
$("#tips_list ul li a").click(function(e) { //... } however, doesn't make lot of sense because have click on actual text instead of list item. figured i'd re-structure html anchor tag wraps around li tag.
`<a href="#" name=""><li>foo</li></a>` i changed jquery code accordingly:
$("#tips_list ul li").click(function(e) { //... } however, now, when click.. grabs list item tag $(this); means can't grab name attribute anchor tag. so! need grab name attribute parent anchor tag. , have no clue easiest way is. i'm not experienced jquery.
thanks lot helping me!
how going original method, , set #tips_list ul li {display:block} in css? should make expand , take whole li, making whole li seem clickable. original code should work fine.
Comments
Post a Comment