title: call a function with single quotes
body: <p>I have to call the following javascript function</p>
  
  <pre><code>function changeExampleField(firstValue, changeId, field, wordToChange)
  {
   var exampleTxtElem = document.getElementById(changeId);
   var newTxt = field.value;
   exampleTxtElem.innerHTML = firstValue.replace(wordToChange, newTxt);
  }
  </code></pre>
  
  <p>The problem at this is, I get the value of "firstValue" from the database, it is a String and it can contain single quotes. For example:</p>
  
  <p>I get a value from the database which operates</p>
  
  <pre><code>&lt;input class="" type="text" name="text_label.test_virus_connection" value="test" size="50" maxlength="50" id="a_text_label.test_virus_connection"   onkeyup="changeExampleField('Verbindung testen', 'example_label.test_virus_connection', this, 'test')"  onFocus="dispHelp('')"&gt;
  </code></pre>
  
  <p>But i can get values from the database which dont operates</p>
  
  <pre><code>&lt;input class="" type="text" name="text_pass_sprachtest.label.execute.successfull" value="test" size="50" maxlength="50" id="a_text_pass_sprachtest.label.execute.successfull"   onkeyup="changeExampleField('Bewerbung(en) erfolgreich auf 'Sprachtest(s) bestanden' gesetzt!', 'example_pass_sprachtest.label.execute.successfull', this, 'test')"  onFocus="dispHelp('')"&gt;
  </code></pre>
  
  <p>My question is: is there a different way to call the function (for example with properties or so)? Or a different way to solve this problem?</p>