tags:

views:

53

answers:

1

Hello

I need to go though a content of element, and replace every tabulator \t with text "(Here's a tab)". How is this possible?

Martti Laine

+4  A: 

You can use the replace() method on a string:

var el = $('#myEl').text();
el.replace(/\t/g, "(Here's a tab)");

Note: you must use a regular expression with the /g modifier to replace every instance of \t, using a string for the search will only replace the first occurrence.

Andy E