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
  • 179
  • 4
  • 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
  • 143,310
  • 32
  • 282
  • 281
0

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


Escape quotes in JavaScript