¡@

Home 

2014/10/16 ¤W¤È 12:02:30

jquery Programming Glossary: class_id

How to assign event callbacks iterating an array in javascript (jQuery)

http://stackoverflow.com/questions/1104321/how-to-assign-event-callbacks-iterating-an-array-in-javascript-jquery

A stripped code sample might clear things up a bit for class_id in classes callback function this.selectClass class_id li_item.. for class_id in classes callback function this.selectClass class_id li_item jQuery ' li li ' .click callback Actually more is going.. list items it will always execute the action for the last class_id in the classes array as it uses the function stored in callback..

How to assign event callbacks iterating an array in javascript (jQuery)

http://stackoverflow.com/questions/1104321/how-to-assign-event-callbacks-iterating-an-array-in-javascript-jquery

trouble getting the right callback attached to the right item. A stripped code sample might clear things up a bit for class_id in classes callback function this.selectClass class_id li_item jQuery ' li li ' .click callback Actually more is going on.. item. A stripped code sample might clear things up a bit for class_id in classes callback function this.selectClass class_id li_item jQuery ' li li ' .click callback Actually more is going on in this iteration but I didn't think it was very relevant.. stored copied . End result When a user clicks any of the list items it will always execute the action for the last class_id in the classes array as it uses the function stored in callback at that specific point. I found dirty workarounds such as..