我的功能有什么问题?为什么它打印多次而不是一次?
$('document').ready(function(){
//click a button dozen times it invokes submit and write message in console.log
$('button').live('click', function(){
$this = $(this);
submit($this); //this function maybe push in stack a lot of times
});
});
function submit($this){
img = $this.nextAll(".submit");
// and when I click on image it must write one time but it writes a lot of times
img.on('click', function(){
console.log($this.text() + " ----> click"); //
});
}