我試圖讓我的代碼點擊並顯示警告,但代碼似乎不起作用。我已經寫在這裏的代碼:JQuery單擊函數不工作
https://jsfiddle.net/MGames/9eu94Lau/1/
這裏是我的html:
<div class="add-cart-button-col col-right">
<a class="checkout-button nsg-button nsg-grad--heeb-orange" href="https://mycheckoutlinkgoeshere.com" data-query="https://linkcheckoutgoeshere.com">
CHECKOUT
</a>
</div>
這裏是不點擊
$(".checkout-button nsg-button nsg-grad--heeb-orange").click(function() {
alert('hohoho');
});
後顯示警報代碼我希望能幫助我找出我做錯了什麼。謝謝。
編輯:這個問題是不同的,因爲我要求澄清我的代碼中存在的錯誤。這不是選擇與多類元素的副本...
https://stackoverflow.com/questions/1041344/how-can-i-select-an-element-with-multiple-classes-in-jquery –
'.checkout-button nsg-button nsg-grad-- heeb-orange'!=='.checkout-button .nsg-button .nsg-grad - heeb-orange' –