Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

jQuery Syntax

I have a question about jQuery Syntax.  I am using a CMS that has a tag {row_id} that, of course echos out the row id.  In my jQuery, I am referencing the row ID.  In my code I have this:
	var formUpdate_{row_id} = function() { 

Open in new window

in In my development IED this line gives me an error.  Is there a way to escape this and still have it work so the error is gone?
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Depending on the placement of this code and the scope you need the variable(s) to be in you might be able to use:
window['formUpdate_{row_id}'] = function() {

Open in new window

or
this['formUpdate_{row_id}'] = function() {

Open in new window

That should be valid code for the IDE and with a bit of luck your CMS does the replace regardless of the fact that the tag is now in a javascript literal.
You could use eval().
ASKER CERTIFIED SOLUTION
Avatar of skij
skij
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial