2012-10-15 53 views
0

在我mobilejquery項目,我需要解除綁定的鏈接(的HREF),並將它們綁定一個點,對於這一點,我用這個代碼:jquerymobile如何綁定和取消綁定鏈接?

$(document).bind('pageinit', function() { 

    $('a[href="#"], a.disabled').bind('click',function (e) { 
     e.preventDefault(); //sets all dynamic href to prevents wrong url 
    }) 
}); 

,但不是在所有的作品...什麼毛病我碼?

其他問題..

我不希望顯示在導航器的URL路徑..有什麼辦法,使URL路徑不顯示?

回答

-1

您是否嘗試過使用unbind()方法?

$('a[href="#"], a.disabled').unbind("click").bind('click',function (e) { 
    e.preventDefault(); //sets all dynamic href to prevents wrong url 
})