0

I have string $html = ' <button onclick="js_func(this, "in this point")"> submit </button>' I want to send a string to js function I am trying with '/'' string '\' also with "/"" string "\" but didn't get the solution yet. Please guide me with correct solution.

Mohsin
  • 169
  • 2
  • 13

2 Answers2

2

Just escape it with a backslash as simple as this:

$html = ' <button onclick="js_func(this, \'in this point\')"> submit </button>'
VisioN
  • 138,460
  • 30
  • 271
  • 271
0

With \==> ' < button onclick="js_func(this, \"in this point\")"> submit < /button>'


Escape quotes in JavaScript