Web Development

Based on the value in URL parameter change text or contact number in Content section

This post is for those who has knowledge about HTML and jQuery. I am sharing the code directly here, If you have any question or facing similar issue, feel free to ask question in comments section


var params = new window.URLSearchParams(window.location.search);
var coach=params.get('assigned_to');
	if (coach.toLowerCase().indexOf("terry") >= 0){
	var terryNumber='(832)xxx-xxxx';
jQuery("div#call a").text(terryNumber);
jQuery("div#call a").attr("href", "tel:"+terryNumber);
	else if(coach.toLowerCase().indexOf("paul") >= 0){
	var jimNumber='(760)xxxx-xxxx';
jQuery("div#call a").text(jimNumber);
jQuery("div#call a").attr("href", "tel:"+jimNumber);
else if(coach.toLowerCase().indexOf("newname") >= 0){
	var newnameNumber='(760)xxx-xxxx';
jQuery("div#call a").text(newnameNumber);
jQuery("div#call a").attr("href", "tel:"+newnameNumber);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s