Skip to content

Instantly share code, notes, and snippets.

@TechFounder
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TechFounder/8876459 to your computer and use it in GitHub Desktop.
Save TechFounder/8876459 to your computer and use it in GitHub Desktop.
A useful jQuery snippet to make any tagged item a clickable link. This is how in Rails.
[data-link] {
cursor: pointer;
}
ready = ->
$("[data-link]").click ->
window.location.href = $(this).attr("data-link")
false
$(document).ready(ready)
$(document).on('page:load', ready)
<div data-link=<%= the_path %> id="home_div_left">
or
<div data-link="http://url.com" id="home_div_left">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment