Hello I am using “JavaScript snippet(Data Source)” widget in my app. I have enabled jQuery3.1.1 inside the snippet and used JQuery datepicker. I have given datasource as a dateandtime attribute(say MyDate) from an entity. This widget I have placed inside the Dataview of the same entity. I have given variable name to this attribute as “testing”. So now, inside this JS snippet, I have referred to this attribute using its variable name as ${testing}.datepicker({…….}) but when I run my app, I am getting an error ,”Error while evaluating javascript input: SyntaxError: Unexpected token {” and “snippetjs_widget_snippetjs_datasource_0: Error while evaluating javascript input.” As per the error, I understood that I should not refer as, ${testing}, but the snippet says we should use ${variable name} format for referring to the attribute. Can someone please guide me how to eliminate this error.
asked
Manasa Amujuri
2 answers
2
It looks like you are using the attribute as a selector. You are forgetting the jQuery selector. I think the proper way to do it is:
$("${testing}").datepicker({…….})
answered
Jelte Lagendijk
0
Manasa,
Can you try by replacing your code with below code.