comments in element javascript stop the execution of the js at that point

Status
Not open for further replies.

skyrun

Active Member
this one took me awhile to figure out...

but this works in an element javascript:
Code:
alert('hi');

and this doesn't! no js error, just doesn't execute beyond the first comment it sees, so nothing happens.
Code:
//test
alert('hi');
 
You can't use comments in "inline" JS like that. If you look at the source of your page, you'll see why - the newlines get stripped, so everything after the // becomes commented out.

If you have code complex enough to require commenting, put your code inside a function in a ./components/com_fabrik/js/form_X.js file, comment it there, and just call the function from the inline box on the element.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top