我想在我的html頁面上使用這部分代碼,它工作正常,但我不明白如何更正驗證器上的錯誤。我把函數放在div
中,但是在a
中我們有同樣的錯誤。這裏是stackoverflow question的鏈接。ontouchend屬性有驗證錯誤,但工作正常
這是驗證錯誤:
Error: Attribute ontouchend not allowed on element div at this point.
這裏是CSS代碼:
:hover {
background: red;
}
在JS,我有:
function fix() {
var el = this;
var par = el.parentNode;
var next = el.nextSibling;
par.removeChild(el);
setTimeout(function() {
par.insertBefore(el, next);
}, 0);
}
然後在我的HTML我有:
<a href="#" ontouchend="this.onclick=fix">test</a>
這部分對我來說似乎很腥:'this.onclick = fix'你在這裏想達到什麼目的? – jmargolisvt
我有一個懸停在iPhone,iPad上,當我點擊一個鏈接,CSS懸停保持活動,與此功能,我可以刪除CSS當我觸摸屏幕 – coolio83000