Use jQuery to Change Web Page Phone Number

By Sam Deering

Simple jQuery code snippet to change the phone number on a web page. Just say we have a web site with the phone number 999 all over it and we want to change it to 041642×589 (just some random digits) but only for a page called ‘bobs-page’. This is how you do it.

$(document).ready(function() {

	var pageUrl = window.location.href;
	var pageCheck = 'bobs-page';
    var isBobsPage = (pageUrl.indexOf(pageCheck) >= 0);
     //check if it's bobs page
    if (isBobsPage) {

Read here for more info on getting url params.

No Reader comments



Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.