Suppose there is element on which we want to add class on hover and remove on unhover and all that with jquery then dot eh following code :
<div>
<span>John,</span>
<span>Karl,</span>
<span>Brandon,</span>
<span>Sam</span>
</div>
<div>
<span>Glen,</span>
<span>Tane,</span>
<span>Ralph,</span>
<span>David</span>
</div>
$("span")
.css({ color: "red", fontsize: "140%" })
.hover(function () {
$(this).addClass("solast");
}, function () {
$(this).removeClass("solast");
});
and class is as follow :
span.solast
{
text-decoration: line-through;
}
Done
<div>
<span>John,</span>
<span>Karl,</span>
<span>Brandon,</span>
<span>Sam</span>
</div>
<div>
<span>Glen,</span>
<span>Tane,</span>
<span>Ralph,</span>
<span>David</span>
</div>
$("span")
.css({ color: "red", fontsize: "140%" })
.hover(function () {
$(this).addClass("solast");
}, function () {
$(this).removeClass("solast");
});
and class is as follow :
span.solast
{
text-decoration: line-through;
}
Done
Comments
Post a Comment