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
Release: 2016-05-16 16:40:15
Original
1423 people have browsed it

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); 
}); 
}
Copy after login

Test code:

 
 
 

 
 
 
 
 
 
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template