JSFiddle - React, Tailwind, and code Playground
by Allendar
JavaScript
//This will actually fetch the categoryID you want:
var href = window.location.href;
var regex = href.match(/categoryID=(\d+)/g);
if (regex != null) {
if (regex.length > 0) {
var catID = regex[0].replace('categoryID=', '') * 1;
console.log(catID);
if (catID == 308) {
document.getElementById('website').innerHTML = '<p>This is the Apartments Category page</p>';
}
else {
document.getElementById('website').innerHTML = '';
}
}
else {
console.log('ID couldn\'t be found! :(');
}
}
else {
console.log('ID couldn\'t be found! :(');
}
//You can do whatever you want with it afterwards. It's safer than to check the whole URL.
//Good luck on your learning endeavors :)