title: How to inline JavaScript with Thymeleaf
body: <p>I would like to use Thymeleaf to do inline Javascript.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;script th:inline="javascript"&gt;
  /*&lt;![CDATA[*/
    /*[[${myCode}]]*/;
  /*]]&gt;*/
  &lt;/script&gt;
  </code></pre>
  
  <p>and in Spring Boot I have this:</p>
  
  <pre><code>model.addAttribute("myCode", "alert("test")");
  </code></pre>
  
  <p>My output HTML is:</p>
  
  <pre><code>&lt;script th:inline="javascript"&gt;
  /*&lt;![CDATA[*/
    "alert("test")";
  /*]]&gt;*/
  &lt;/script&gt;
  </code></pre>
  
  <p>which is a string. What am I doing wrong?</p>