2011-11-28 69 views
0

我需要能夠觸發.live函數中的典型鏈接事件,如下所示。.live函數中觸發href事件

$(".next").live('touchstart', function(event) { 
    //trigger link event 
}); 

對於典型的href操作有些不同。

回答

2
//i assume your href id is 'hrefid' 

$(".next").live('touchstart', function(event) { 
    //trigger link event 
    $("#hrefid").click(); 
}); 
1

如果你的意思是要導航到一個頁面,你可以這樣做:

$(".next").live('touchstart', function(event) { 
    //trigger link event 
    window.location.href = "http://www.google.com"; 
}); 
2
$('.next').live('touchstart', function(event) {  
window.location.href = $(this).attr('href'); 
});