Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - conditional variable

0 votes
2 views
added Jun 10 in jQuery by lcjr Second Warrant Officer (5,520 points)
$('#whatsapptep').click(function(){
    var whatsAppPhone = '60173686061';   
    var defaultMessage = "";
    var url = window.location.href;
    if(url.includes('1860554')) {
      defaultMessage = "Hi, I'm interested to know more about this product:";
    }  else {
      defaultMessage = "Hi, I'm interested to know more about this project:";
    } 
    window.open(
      "https://wa.me/"+whatsAppPhone+"?text="+defaultMessage+" "+window.location.href,
      '_blank',
    );
});

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...