var divText; var newText; var link; var date; $('div').each( function() { divText = $(this).html(); if( divText.indexOf('posted') != -1 ) { newText = divText.split('posted'); var link = newText[0]; var date = newText[1]; $(this).html(link + date); } }); but now need to have it run for only 5 digit zip code and a phone number