javascript - Using argument (this) passed via element eventhandler -


I pass the argument (i) in a JS function and want to use it as a jQuery variable. Example:

  & lt; Script & gt; Function in use (obj) {$ (obj) .val (); ... ... ...} & lt; / Script & gt; & Lt; Select ID = "selectid" onChange = "Use (this)" & gt; & Lt; Options & gt; ...... & lt; / Options & gt; & Lt; / Select & gt;  

There is a possibility to treat passed logic as a jQuery element?

Btw I have to do this because the selection element is not made on the weight. The selection element will later be made in asynchronous form

Then, it will not work:

  $ ("select") each (function (i) {var select_id = $ (This) .attr ("id"); $ (this) .change (function (e) { 

because it still does not exist.

Your help Thank you for.

If your element is not built on the load, and instead load asynchronous So you can force such a change event:

  $ ('select') Live (' 

Update : For this Requires less jQuery 1.4.1


Comments