Home >Web Front-end >JS Tutorial >jquery bind(click) passes parameters to bind an event to each row in the list_jquery

jquery bind(click) passes parameters to bind an event to each row in the list_jquery

WBOY
WBOYOriginal
2016-05-16 16:40:151419browse

It is common to click on a row in the list to pop up details. When using jquey bind to click on an event, carelessness in passing parameters may result in the same content being displayed on every row clicked. This is mostly caused by carelessness in passing parameters. The simple code is as follows:

for(var i=0;i<2;i++) { 
$("#b" + i).bind("click", {'bindText':bindText + i}, function(e){ 
butClick(e); 
}); 
}

Test code:

 
 
 

 
 
 
 
 
 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn