parent(exp)用法:取得一个包含着所有匹配元素的唯一父元素的元素集合。
- <script src="jquery-1.2.6.min.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $("#btn1").click(function(){
- alert($(this).parent().next().html());
- });
- });
- </script>
- </head>
- <body>
- <table>
- <tr>
- <td><input id="btn1" class="btn" type="button" value="test"/></td>
- <td>some text</td>
- </tr>
- </table>
- ....
其中:
- this.parent()是input前面的td
- this.parent().parent()获取的是tr
- this.parent().parent().parent()获取的是table
- this.parent().next()获取的是td相临的td
另例子中:
<div><p>Hello</p><p>Hello</p></div>
$("p").parent() 得到的是:<div><p>Hello</p><p>Hello</p></div>对象,因为p标签的父标签是div.
分享到:
相关推荐
jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)...
jquery-1.11.1.js 、jquery-1.11.1.min.js 【官方jquery包 js】
最新版jquery-1.6.4-vsdoc.js jQuery的VS智能提示插。压缩包内包含jquery-1.6.4.js jquery-1.6.4.min.js jquery-1.6.4-vsdoc.js 。 【推荐用法】 1、将jquery-1.6.4-vsdoc.js与jquery-1.6.4.js放在同一目录,然后...
这里包含jquery-ui-1.8.16.custom.min.js/jquery-ui-1.8.16.custom.css,我费了好长时间找到的,此东西可以配合jQuery UI开发指南一书使用。
jquery-3.0.0.js 、jquery-3.0.0.min.js 【官方jquery包 js】
jquery-1.9.1.js 、jquery-1.9.1.min.js 【jquery包 js】
jquery-ui-日期框扩展成时间框 jquery-ui时间框 基于别人的代码进行修改 jquery-ui-1.8.16.custom.css文件末尾加入以下代码 .ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; } .ui-timepicker-div dl{ ...
jQuery-1.12.4.js和jQuery-1.8.3.min.js,适合开发人员在学习jquery时导入使用,使代码更加简洁。
jquery-1.11.0 + jquery-UI-1.10.4
【推荐用法】 1、将jquery-1.6.2-vsdoc.js与jquery-1.6.2.js放在同一目录,然后在vs中添加对jquery-1.6.2.js的引用即可; 2、切记:两个文件的文件名不能修改,并且只要引用jquery-1.6.2.js而不要引用jquery-1.6.2-...
jquery-ui-1.9.2.custom.min.js
jquery-2.1.1.js 、jquery-2.1.1.min.js 【jquery包 js】
jqueryUi-181107亲测可用,对应jquery-ui.min.js文件。
最新JQuery版本,3.2版本删减jQuery.holdReady(hold),jQuery.isArray(obj)等方法
jquery-ui-1.10.3.min.js
jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js jquery-1.8.3.js
jquery-migrate-1.2.1.min.js 可以更好的帮助 jqury-jqprint 兼容性问题
jquery插件jquery-ui-1.8.2.custom.min.js
jquery-1.6.2.js 源文件 还有 自己学习的时候写的小例子 分享一下
jquery-ui-1.9.2.(免费),适合javascript开发者参考,包含各种美观的用户交互界面