title: Manipulate elements inside html string
body: <p>I have the following template.</p>
  
  <pre><code>&lt;script id="signoff-form" type="text/plain"&gt;
      &lt;form method="POST" action="" accept-charset="UTF-8" role="form"&gt;
          &lt;input name="_token" type="hidden" value="{{ csrf_token() }}"&gt;
          &lt;input name="task_id" value="" id="task_id"&gt;
      &lt;/form&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>Now I want to set the URL for the action and set the value for the task_id input.</p>
  
  <pre><code>var href = $(this).attr('href');
  var task = $(this).data('task-id');
  
  var form = $("#signoff-form").html();
  </code></pre>
  
  <p>This handles the URL part ok however I cant work out how to set both.</p>
  
  <pre><code>$(form).attr('action', href).appendTo('body');
  </code></pre>
  
  <p>Your expertise would be much appreciated.</p>
  
  <p>Thanks.</p>