Hi all,
I'm writing a HTML-template ScriptRunner scripted field with a mixture of JavaScript and Groovy. Example:
def a = 1 def b = 2 def c = 3 def output = ''' <select id="test" onChange="runMe()"> <option value="'''+a+'''">a</option> <option value="'''+b+'''">b</option> <option value="'''+c+'''">c</option> </select> <script type="text/javascript"> function runMe() { var selectTag = document.getElementById("test"); var selectValue = selectTag.options[selectTag.selectedIndex].value; alert("my value is: "+selectValue); } </script>'''
IntelliJ IDEA doesn't interpret / validate / code complete any of the JavaScript because as far as it's concerned, the JavaScript is a String.
What's a clean way to separate the JavaScript from the Groovy code so when I edit the JavaScript, IntelliJ IDEA interprets / validates / code completes the JavaScript accordingly?
Community moderators have prevented the ability to post new answers.
Solution:
Put HTML and JavaScript into their own files, then read those files in as strings and echo their output
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.