手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery查看选中对象HTML代码的方法
jQuery查看选中对象HTML代码的方法
摘要:本文实例讲述了jQuery查看选中对象HTML代码的方法。分享给大家供大家参考,具体如下:jQuery查看选中对象HTML代码dsaf$(f...

本文实例讲述了jQuery查看选中对象HTML代码的方法。分享给大家供大家参考,具体如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src='jquery-1.6.2.min.js'></script> <title>jQuery查看选中对象HTML代码</title> </head> <body> <div> <div id="hb">dsaf</div> </div> <script> $(function(){ alert($("#hb").get(0).outerHTML); }); </script> </body> </html>

运行结果为:

<div id="hb">dsaf</div>

(此处注意与innerHTML的区别!)

希望本文所述对大家jQuery程序设计有所帮助。

【jQuery查看选中对象HTML代码的方法】相关文章:

Jquery注册事件实现方法

JQuery实现动态添加删除评论的方法

jQuery实现不断闪烁文字的方法

JQuery+CSS实现图片上放置按钮的方法

JQuery控制Radio选中方法分析

jQuery实现返回顶部效果的方法

jquery预加载图片的方法

jQuery实现将页面上HTML标签换成另外标签的方法

jQuery实现表格行上移下移和置顶的方法

JQuery中上下文选择器实现方法

精品推荐
分类导航