学习查看选中对象HTML
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery查看选中对象HTML代码</title> </head> <body> <div> <div id="hb">dsaf</div> </div> <script src="/demo/js/jq.js"></script> <script> $(function(){ alert($("#hb").get(0).outerHTML); }); </script> </body> </html>
运行结果为:
<div id="hb">dsaf</div>
(此处注意与innerHTML的区别!)
网友评论文明上网理性发言 已有0人参与
发表评论: