/ Published in: jQuery
                    
                                        
Originally from http://www.pseudocoder.com
Make an li (or div or whatever) clickable without having to wrap it in a link-tag.
Like Matt, I like to add a .hover class to it in order to apply hover effects
                Make an li (or div or whatever) clickable without having to wrap it in a link-tag.
Like Matt, I like to add a .hover class to it in order to apply hover effects
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
//http://www.pseudocoder.com/archives/clickable-box-with-jquery
$(".item-list li").click(function() {
window.location = $(this).find("a.more").attr("href");
});
// add some hover effects
$(".item-list li").hover(
function() {
$(this).addClass("hover");
$(this).append('<div class="learn-more">Learn More</div>');
},
function() {
$(this).removeClass("hover");
$(".learn-more").remove();
}
);
---
.item-list li {
display: block;
}
URL: http://www.pseudocoder.com/archives/clickable-box-with-jquery
Comments
 Subscribe to comments
                    Subscribe to comments
                
                