I was trying to make a row of the table I created using Views into something that was clickable. I'm really not finding anything online and everything I try doesn't give me the effect I'm looking for. I'm hoping someone here could share some insights. Thanks.
1 Answer
Pardon my neanderthalic jQuery skills here, but if you add a CSS class to your view via the UI, let's all it clickable-row
, you could then do something like this in a JavaScript file that basically looks through the HTML and, if it finds a link inside your views row, it makes the surrounding div clickable to that link. So, just as long as one field in your view is a link, you'd be all set.
$('.clickable-row .views-row').each( function() {
if ($(this).find('a').length) {
$(this).click(function() {
window.location=$(this).find('a').attr('href');
return false;
});
}
});