JSFiddle - React, Tailwind, and code Playground

by jakie8

HTML

<div class="clickable" data-href="http://google.com">
    <p>Click Meh</p>
</div>

CSS

.clickable{
    cursor:pointer;
}

.clickable{
    width:100px;
    height:200px;
    padding:50px;
    margin:50px;
    border:1px solid red;
}

JavaScript

$('[data-href]').live('click', function(e){
    var link = $(this).attr('data-href'),
        target = $(this).attr('data-target');

    if (target  == '_blank' || e.metaKey || e.ctrlKey || e.which == 2){
        window.open(link, '_blank');
    } else {
        window.location = link; 
    }
});