Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery add <br> to h2 if h2 contains this word

if the h2 has the word ply i want to add a break.

the titles are dynamically called, the site is html so i can't use php on anything.

heres the h2

11/400-5 4 PLY EXPERIMENTAL TIRE AIRCRAFT TIRE

want it to look like this

11/400-5 4 PLY
EXPERIMENTAL TIRE AIRCRAFT TIRE

so any title that has the word PLY in it will add a break right after the word.

probably pretty easy for all yous out there =)

like image 547
Alex Avatar asked Oct 26 '10 22:10

Alex


1 Answers

Example: http://jsfiddle.net/DbJ2V/

$('h2:contains(" PLY ")').html( function(i,htm) {
     return htm.replace(" PLY ", " PLY<br/>");
});
like image 115
user113716 Avatar answered Oct 30 '22 20:10

user113716