Skip to content Skip to sidebar Skip to footer

Replace Only Replacing The First

I am using the following code to allow line breaks in the JQuery UI tooltip function. $(function() { $( document ).tooltip(); $('.linebreak').tooltip({ content:

Solution 1:

To perform a global replacement you can use g:

Try this

callback($(this).prop('title').replace(/\|/g, '<br />'));

More infor is HERE.


Solution 2:


Solution 3:

use regular expresion Try this

.replace(new RegExp('|', 'g'), '<br/>')

Post a Comment for "Replace Only Replacing The First"