Wrap last word in span

Size
2,072 Kb
Views
14,168

How do I make an wrap last word in span?

What is a wrap last word in span? How do you make a wrap last word in span? This script and codes were developed by Petri Pottonen on 26 November 2022, Saturday.

Wrap last word in span Previews

Wrap last word in span - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>wrap last word in span</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<button>moi</button> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Wrap last word in span - Script Codes CSS Codes

span { color: #f00;
}

Wrap last word in span - Script Codes JS Codes

jQuery(document).ready(function($){ $( "body" ).append( '<div class="image-caption" id="yui_3_17_2_2_1443517385572_2007"><p id="yui_3_17_2_2_1443517385572_2006">© Matti Tuominen #globalfashblogs</p></div>' );
});
$( "button" ).click(function() { $('.image-caption p').html(function(){	// separate the text by spaces	var text= $(this).text().split(' ');	// drop the last word and store it in a variable	var last = text.pop();	// join the text back and if it has more than 1 word add the span tag	// to the last word	return text.join(" ") + (text.length > 0 ? ' <span class="last">'+last+'</span>' : last);	});
});
Wrap last word in span - Script Codes
Wrap last word in span - Script Codes
Home Page Home
Developer Petri Pottonen
Username ketri
Uploaded November 26, 2022
Rating 3
Size 2,072 Kb
Views 14,168
Do you need developer help for Wrap last word in span?

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!

Petri Pottonen (ketri) Script Codes
Create amazing blog posts 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!