问题:
<div id="test"></div>
<script>
$(document).ready(function() {
alert($('#test').id);
});
</script>
Why doesn't the above work, and how should I do this? 为什么上述方法不起作用,我应该怎么做?
解决方案:
参考一: https://stackoom.com/question/Dala/如何使用jQuery获取元素的ID参考二: https://oldbug.net/q/Dala/How-can-I-get-the-ID-of-an-element-using-jQuery
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4483453