Return to Snippet

Revision: 30318
at August 11, 2010 19:48 by Rembrand


Initial Code
//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;
}

Initial URL
http://www.pseudocoder.com/archives/clickable-box-with-jquery

Initial Description
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

Initial Title
Clickable list item (or bock or any other element)

Initial Tags
links

Initial Language
jQuery