49
rated 0 times
[
52]
[
3]
/ answers: 1 / hits: 193600
/ 14 Years ago, mon, february 21, 2011, 12:00:00
Is there an easy equivalent to this in JavaScript?
$find = array(<, >, n);
$replace = array(<, >, <br/>);
$textarea = str_replace($find, $replace, $textarea);
This is using PHP's str_replace
, which allows you to use an array of words to look for and replace. Can I do something like this using JavaScript / jQuery?
...
var textarea = $(this).val();
// string replace here
$(#output).html(textarea);
...
More From » jquery