Create New Div Arround Anchor Link When Clicked
How can I achieve this behaviors onclick with jquery : default state: Anchor click state
Solution 2:
Fastest way to do this:
$('a').click(function() {
$(this).wrap($('<div/>', { 'class': 'highlight'}));
});
However, this is probably what you want, much simpler just use whatever CSS effect you want:
$('a').click(function() {
$(this).addClass('highlight'});
});
Solution 3:
Solution 4:
Why don't you just style a:hover?
Something like this in CSS:
.highlight a {
/* style */
}
.highlight a:hover {
/* hover style */
}
Then change your HTML to:
<a href="something.html" class='highlight'>Anchor</a>
Post a Comment for "Create New Div Arround Anchor Link When Clicked"