Javascript 将jquery用于带“quot;的按钮&引用;在id中
嗨,伙计们,我有一个jquery按钮,如下所示:Javascript 将jquery用于带“quot;的按钮&引用;在id中,javascript,jquery,html,Javascript,Jquery,Html,嗨,伙计们,我有一个jquery按钮,如下所示: <html> <button id = "index.php"> </button> </html> <script> $('#index.php');').click(function(){ //stuff }); </script> $(“#index.php”);”。单击(函数(){ //东西 }); 然而,jquery似乎不接受带“.”的id——有没有办法
<html>
<button id = "index.php">
</button>
</html>
<script>
$('#index.php');').click(function(){
//stuff
});
</script>
$(“#index.php”);”。单击(函数(){
//东西
});
然而,jquery似乎不接受带“.”的id——有没有办法让它工作 尝试转义
$('#index\\.php')。单击(函数(){
console.log('stuff');
});