367   HTML jQuery JS

$(“#id”)和document.getElementById(‘id’)获取的内容是不一样的,
打印出来看看就知道啦

$("#testId"):[canvas#testId]

document.getElementById("testId"):canvas#testId

两者之间的转换:

document.getElementById("testId") = $("#testId").get(0);

$("#testId") = $(document.getElementById("testId"))




Leave a Reply

Your email address will not be published. Required fields are marked *