haitruonginfotech haitruonginfotech - 1 year ago 148
Javascript Question

How to get link URL from JavaScript?

I have the following code :

$i = 0;
foreach($this->list as $l) {
$link = JRoute::_("index.php?option=com_ecommerce&view=detail&id=$l->id");
<div class="quickview" id="quickview_<?php echo $i;?>">
<a href='<?php echo $link ?>' class='basic'>Quick view</a>
jQuery(function ($){
var link = $('.quickview .basic').val();
$('.quickview .basic').click(function (e) {
return false;

I can't get link from tag

Py. Py.
Answer Source

var link =$('.quickview .basic').attr("href"); should do the trick.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download