Skip to content

@fedmich /h2_span1stw.htm
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Stack overflow answers
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var obj_h2 = $('h2');
var h2_title = obj_h2.html();
var words = h2_title.split(' ');
words[0] = '<span>' + words[0] + '</span>'
obj_h2.html( words.join( ' ' ) );
});
</script>
<style type="text/css">
h2 span{
color:red;
}
</style>
</head>
<body>
<h2>Converted post title</h2>
</body>
</html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('h2.title').each( function (){
var obj_h2 = $(this);
var h2_title = obj_h2.html();
var words = h2_title.split(' ');
words[0] = '<span>' + words[0] + '</span>'
obj_h2.html( words.join( ' ' ) );
} );
});
</script>
<style type="text/css">
h2.title span{
color:red;
}
</style>
</head>
<body>
<h2 class="title">Converted post title</h2>
<h2 class="title">Title #2</h2>
<h2 class="title">This is H3 #3</h2>
</body>
</html>
RedirectMatch 301 ^/(site1|site2|category1)(/.*|$) /$1-new$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.