JSFiddle - React, Tailwind, and code Playground

by Mon Cervantes

HTML

<!--<div id="ip">Loading...</div>-->
<div id="country_code"></div>
<div id="MX">México</div>
<div id="World">Bienvenido</div>

CSS

#US { text-align: left; color: blue; display:none;} 
#CA { text-align: left; color: blue; display:none;} 
#World { text-align: left; color: blue; display:none;}

JavaScript

$.get("http://freegeoip.net/json/", function (response) {
		//$("#ip").html("IP: " + response.ip);
	  $("#country_code").html(response.country_code);
        var country = response.country_code;
        if(country =='MX') 
        document.getElementById(country).style.display = "block";
        else 
				document.getElementById('World').style.display = "block";
	}, "jsonp");