jQuery Live Bind
Using $.fn.is_match(selector) to build a live bind method:
sample:
<div class="kkkk">
<div class="ppp1" title="333">hello1</div>
</div>
<script>
function alr(){alert(this.innerHTML);}
function alr1(){alert('hello:'+this.innerHTML);}
$.live_bind(".kkkk .ppp1 + .ppp[title='333']", 'click', alr);
$.live_bind(".kkkk .ppp[title='333']:nth-child(3)", 'click', alr1);
//"tr:eq(3)" should be "tr:nth-child(4)"
//"tr:gt(3)" should be "tr:nth-child(4) ~ tr"
//"tr:gt(0)" could be "tr:not(:first-child)"
//"tr:first" should be "tr:first-child"
$('.kkkk').append('<div class="ppp" title="333">hello</div>');
$('.kkkk').append('<div class="ppp" title="333">jack</div>');
</script>
评论