Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

is that possible to Read the value from sightly and set through jQuery

Avatar

Level 4

Hi All,

i have a requiremnt that read the value from sightly and set through jquery. If we have a alternate way kindly let me know.

Reading the value from author node and displaying on preview/publisher mode

code snippet:

var a = ${pageProperties['pagecontent/offertitle/title']}

jQuery("#title").text(a);

3 Replies

Avatar

Level 4

Hi,

The variable value you read in sightly can be set in a hidden html input field on the page and the same field can then be accessed in jquery.

Avatar

Community Advisor

Hi,

You can directly used the variable in script tag in sightly using sightly context based on your requirement. Or you can also try using JS API as mentioned by smacdonald2008

<script>

var variable = '${properties.variablename @ context="scriptString"}'; // This can be used in javascript included after it as it is available as global variable

</script>

Hope this helps !