Monday, 15 September 2014

php - Function for escaping quotes in javascript? -



php - Function for escaping quotes in javascript? -

this question has reply here:

encode html entities in javascript 8 answers

is there function in javascript same htmlentities($string, ent_quotes) in php? searched lot couldnt find it, recommending regex.

just wanted create sure there no other easier way before seek that

see tutorial

it's 'port' of php's htmlentities function:

function htmlentities(str) { homecoming string(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); }

javascript php quotes

No comments:

Post a Comment