-2
<a class="track_this" href="http://www.google.com" target="_blank">google</a>
WORKS:jQuery的不能识别类选择,但工作没有它
jQuery(document).ready(function($){
$("a").click(function() {
$.post("http://example.com/clk.php",{URL:this.href});
return true;
});
});
不起作用:
jQuery(document).ready(function($){
$(".track_this").click(function() {
$.post("http://example.com/clk.php",{URL:this.href});
return true;
});
});
非常沮丧。任何帮助将不胜感激。
您通常希望避免类和id名称中的下划线。改为使用连字符。 – Gavin
这两个代码都能正常工作..我的意思是,它被称为点击事件。 https://jsfiddle.net/lbclucascosta/8bdq6p54/ –
@Gavin强调,虽然烦人的类型,是完全有效 – DelightedD0D