Get url info and break up into classes then add to body class

Size
1,651 Kb
Views
12,144

How do I make an get url info and break up into classes then add to body class?

What is a get url info and break up into classes then add to body class? How do you make a get url info and break up into classes then add to body class? This script and codes were developed by Michael Stursberg on 27 October 2022, Thursday.

Get url info and break up into classes then add to body class Previews

Get url info and break up into classes then add to body class - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Get url info and break up into classes then add to body class</title>
</head>
<body> <div class="container"> &#60;body class="<span id='example'></span>" &#62;
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Get url info and break up into classes then add to body class - Script Codes JS Codes

//Getting the URL dynamically
var url = $(location).attr('href');
// Getting the file name i.e second to last segment of URL
var fn1 = url.split('/').reverse()[1];
var fn2 = url.split('/').reverse()[2];
var fn = url.split('/').reverse()[0];
// Getting the file name i.e last segment of URL with out ext (i.e. example )
var fn0 = fn.split('.').reverse()[1];
$("body").addClass();
$("#example").text(fn2 + " " + fn1 + " " + fn0)
console.log(fn2 + " " + fn1 + " " + fn0);
Get url info and break up into classes then add to body class - Script Codes
Get url info and break up into classes then add to body class - Script Codes
Home Page Home
Developer Michael Stursberg
Username thesturs
Uploaded October 27, 2022
Rating 3
Size 1,651 Kb
Views 12,144
Do you need developer help for Get url info and break up into classes then add to body class?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Michael Stursberg (thesturs) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!