Home >Web Front-end >JS Tutorial >jquery bind(click) passes parameters to bind an event to each row in the list_jquery
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: