RE: How to use JQuery in the web screen.

RE: How to use JQuery in the web screen.

  
Hi, I am trying to do a simple test, Alerting the text which is inside of the div. The name of the container is "div_test". I am

adding "wt" to refer it in the javascript. I am using this syntax, alert( $("#wtdiv_test").text()). It is not working. Then, I added

the script tag in the "webscreen javascript" Area and refered this js file (jquery-1.3.2.min.js), It didn't work. If I simply put like

this "document.getElementById("wtdiv_test").innerHTML", It worked. Can anyone help me how can I use Jquery in the

webscreen.

Thank's in advance.
Praburaj Vishvanathan

(Logica)

Hi,

The webscreen javascript is for you to write javascript statements that support the webscreen. This means that you can't reference another javascript file in it.

 

To solve your problem, you can do one of the following:

- Copy the contents of the jquery-1.3.2.min.js into the webscreen javascript. This way jquery will be available in the web screen.

- Create a reusable webblock named "jquery" and set its webblock javascript as the contents of the jquery-1.3.2.min.js file. This will allow you to reuse jquery in every screen you wish by simply adding the webblock to the screen.

 

Another remark: to obtain a widget runtime identifier in the final html, you can use <WidgetName>.Id in an Expression, rather than adding the "wt" prefix to the widget name. So in your case, the alert expression would be:

"alert($('#" + div_test.Id + "').text())"

 

Thank you!

Hi ,

Thanks for your help. I tested with your solution. And It worked.
Regards
Praburaj Vishvanathan (Prabu).
Logica

Ricoardo says:
To solve your problem, you can do one of the following:
- Copy the contents of the jquery-1.3.2.min.js into the webscreen javascript. This way jquery will be available in the web screen.
- Create a reusable webblock named "jquery" and set its webblock javascript as the contents of the jquery-1.3.2.min.js file. This will allow you to reuse jquery in every screen you wish by simply adding the webblock to the screen


Why not use AddJavascriptTag ??

And how to use any other external jQuery script ?
This because most of the jQuery files use $ for the jQuery reference ...