效果
这个 div 的 id 是 ಠ ,点击测试 原生 JavaScript 选择器
这个 div 的 class 是 ❤,点击测试 jQuery 选择器
代码
HTML结构
右键查看源代码
CSS代码
#ಠ{background-color: red;} .❤{background-color: green;}
JS代码
$(function(){ $('.❤').click(function(){ alert('成功了,jQuery 选择器支持 ❤'); }); var aaa = document.getElementById("ಠ"); aaa.onclick = ceshi; function ceshi(){ alert('原生 JavaScript 选择器支持'); } });