is that possible to Read the value from sightly and set through jQuery | Adobe Higher Education
Skip to main content
mikezooz
Level 4
February 28, 2018
Frage

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

  • February 28, 2018
  • 3 Antworten
  • 2719 Ansichten

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);

Dieses Thema wurde für Antworten geschlossen.

3 Antworten

smacdonald2008
Level 10
February 28, 2018

Have you tried using JS API with HTL?

Rima_Mittal
Level 4
February 28, 2018

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.

Ravi_Pampana
Community Advisor
Community Advisor
February 28, 2018

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 !