javascript - How to pass a 'constant' parameter in jquery -
 I have a div element attached to it, which detects that a user right clicks and calls a function   The code is moved inside a loop (where     You get the value of  Functionality .   
 $ ('# box_' + i) .bund ('mousudown', function (e) {if (e.which == 3) function, i)});    i  variable increases), because there are many divs that require correct click functionality on the page. However when it is called  function , it always gets the last value of  i  instead of that value, when it was tied (). Is there a way to make it continuous, so the  i  in a local area inside your loop To do this:   
 // start your loop (function (i) {$ ('# box_' + i) .bund ('moushudown', function (e) {if (e .hig == 3) function (e, i)});}) (i); // End your loop    
 
  
Comments
Post a Comment