我只是試圖實現一個導航到單獨的錨標記,當用戶點擊從購物車頁面的繼續按鈕。
這是一個使用Cordova的移動應用程序,雖然這個函數調用是JQuery。
的HTML是
<a id="cart-continue" data-theme="none" class="cart-continue continue-button header-button">Continue</a>
的JS在app.js
$("#cart-continue").click(function(){
console.log("**Entered the Click for Continue**");
if(cart.itemCount() == 0)
{
return false;
}
if (Status == "true")
{
$.mobile.changePage("#card-message");
}
else
{
$.mobile.changePage("#may-we-suggest");
}
});
我用簡單的函數調用之前還真沒見過的問題,我們也將應用程序的服務器和呼叫它來自地址。 可能會發生什麼情況,不允許我使用適當的對象的ID並進行函數調用?
從您的上下文中不確定,但是您是否將它包裝在document.ready中? –
我把你的代碼扔在一支筆裏,並對其進行測試。它工作正常。 http://codepen.io/The_Animator/pen/eujtC – Derek
不,它在$(#Page).live(function(){}) – Keeano