How to select img inside <a> tag with jQuery? -
the html looks this:
<ul id="nav"> <li> <a class="parent">first level<img class="right" src="gfx/arrow-news-slider-title.png"></a> <ul class="light"> <li class="full"> <a href="">second level</a> </li> <li class="full"> <a href="">third level</a> </li> <li class="full"> <a href="">...</a> </li> </ul> </li>
here script far:
window['dropdown'] = { open: function(e){ var dd = this; var = $(e).children('a:first-child'); $(e).children('ul').slidedown(); $(a).unbind('click'); $(a).bind('click',function(){dd.close(e)}); $(e).addclass('open'); }, close:function(e){ var dd = this; var = $(e).children('a:first-child'); $(e).children('ul').slideup(); $(a).unbind('click'); $(a).bind('click',function(){dd.open(e)}); $(e).removeclass('open'); }, init:function(){ var dd = this; $('#nav').find('li').each(function(){ if($(this).find('ul').length > 0){ var li = this; var $li = $(this); var = $li.children('a:first-child') $(a).bind('click',function(){ dd.open(li); }); } }); } };
at moment u can open "first level's" clicking anywhere in li tag, open them if clicking arrow-image. have idea how this?
something simple work.
<script> $(document).ready(function(){ $("a#yourlink img").event(); }); </script>
Comments
Post a Comment