code_junkie

Passing in a text to a javascript function that may have a single quote

Nov 11th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <a onclick="Edit('value from a text column here')" href="javascript:void(null);">Edit</a>
  2.  
  3. <a onclick="Edit('I'm a jelly donut')" href="javascript:void(null);">Edit</a>
  4.  
  5. <a onclick="Edit('Iu0027m a jelly donut')" href="javascript:void(null);">Edit</a>
  6.  
  7. <script>function getQuote() { return "'" }</script>
  8. <a onclick="Edit('I' + getQuote() + 'm a jelly donut')" href="javascript:void(null);">Edit</a>
  9.  
  10. <script>var g_strJellyText = "Iu0027m a jelly donut"</script>
  11. <a onclick="Edit(g_strJellyText)" href="javascript:void(null);">Edit</a>
Add Comment
Please, Sign In to add comment