jQuery获取父窗口的元素
js获取父页面的元素可以用
$(window.parent.document).find("#customer_id").val();这里的customer_id表示父页面某一个元素的id。
比如:父页面有一个隐藏的input框
<input id="customer_id" type="hidden" value="${distributor.customer_id}"/>,
那么在子页面就可以用上述的语句取到父页面的id为customer_id的值。
jQuery替换div里的内容:
$('#id名').html('要替换的内容');
jQuery 添加新内容有以下四个方法:
append() - 在被选元素的结尾插入内容
prepend() - 在被选元素的开头插入内容
after() - 在被选元素之后插入内容
before() - 在被选元素之前插入内
<table id = "test"> <thead>
<tr><th>列1</th><th>列2</th><th>列3</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>1</td><td>2</td></tr>
<tr><td>2</td><td>4</td><td>5</td></tr>
</tbody>
</table>
<input type="button" id="btn1" value="在开头增加">
<input type="button" id="btn2" value="在末尾增加">
$(function(){
$("#btn1").click(function() {
$("#test tbody").prepend('<tr><td></td><td></td><td></td></tr>');
});
$("#btn2").click(function() {
$("#test tbody").append('<tr><td></td><td></td><td></td></tr>');
});
})
jQuery获取父窗口的元素的更多相关文章
- jquery 获取父窗口的元素 父窗口 子窗口
一.获取页面元素 取父窗口的元素方法:$(selector, window.parent.document); 那么你取父窗口的父窗口的元素就可以用:$(selector, window.parent ...
- 解析jquery获取父窗口的元素
("#父窗口元素ID",window.parent.document); 对应javascript版本为window.parent.document.getElementByIdx ...
- jQuery 获取父窗口的元素 父窗口 子窗口(iframe)
$("#父窗口元素ID",window.parent.document); 对应javascript版本为window.parent.document.getElementById ...
- jquery获取父窗口的元素[转]
$("#父窗口元素ID",window.parent.document); 对应javascript版本为window.parent.document.getElementById ...
- jquery 获取父窗口的元素、父窗口、子窗口
一.获取父窗口元素: $("#父窗口元素ID",window.parent.document):对应javascript版本为window.parent.document.getE ...
- js/jquery如何获取获取父窗口的元素
1.$("#父窗口元素ID",window.parent.document); 对应javascript版本为 window.parent.document.getElementB ...
- Js/Jquery获取iframe中的元素 在Iframe中获取父窗体的元素方法
在web开发中,经常会用到iframe,难免会碰到需要在父窗口中使用iframe中的元素.或者在iframe框架中使用父窗口的元素 js 在父窗口中获取iframe中的元素 1. 格式:window ...
- 获取父窗口元素或者获取iframe中的元素(相同域名下)
jquery方法 在父窗口中获取iframe中的元素 //方法1 $("#iframe的ID").contents().find("iframe中的元素"); ...
- 在iframe窗体内 获取父级的元素;;在父窗口中获取iframe中的元素
在iframe中获取父窗口的元素 $(‘#父窗口中的元素ID’, parent.document).click(); 在父窗口中获取iframe中的元素 $(“#iframe的ID”).content ...
随机推荐
- uniapp跨域两次请求解决方案
引入qs模块 使用 qs模块将data序列化,再传递,注意header必须设置为 'content-type':'application/x-www-form-urlencoded', import ...
- [转帖]Pivotal Greenplum 6.0 新特性介绍
Pivotal Greenplum 6.0 新特性介绍 https://cloud.tencent.com/developer/news/391063 原来 greenplum 也是基于pg研发的. ...
- fiddler手机抓包1
1.手机抓包配置教程:https://www.jianshu.com/p/724097741bdf 2.
- spring-cloud项目搭建
springCloud项目搭建手册 springcloud应用场景及微服务框架发展趋势 Spring Cloud为开发人员提供了工具,以快速构建分布式系统中的某些常见模式(例如,配置管理,服务发现,断 ...
- Postman和jmeter的区别
1.创建接口用例集(没区别) Postman是Collections,Jmeter是线程组,没什么区别. 2.步骤的实现(有区别) Postman和jmeter都是创建http请求 区别1:postm ...
- malloc/free和new/delete详解与应用
C++面试经常会问到关于malloc/free和new/delete的区别,网上有不同版本的解释,这里总结下并加上个人理解和使用. 两者相同点 1.都可以申请动态堆内存. 两者不同点 1.new/de ...
- Python_OpenCV视频截取并保存
在图像处理之前,我们需要对拿到手的数据进行筛选,对于视频,我们需要从中截取我们需要的一段或几段 整体思路比较简单,通过设定截取视频的起止时间(帧数),可以将该时间段内的图像保存为新的视频 直接上代码: ...
- ggplot2|theme主题设置,详解绘图优化-“精雕细琢”-
本文首发于“生信补给站”公众号,https://mp.weixin.qq.com/s/hMjPj18R1cKBt78w8UfhIw 学习了ggplot2的基本绘图元素ggplot2|详解八大基本绘图要 ...
- [C#] LINQ之SelectMany和GroupJoin
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Java Web 深入分析(8) Servlet工作原理解析
Servlet Servlet(Server Applet)是Java Servlet的简称,称为小服务程序或服务连接器,用Java编写的服务器端程序,主要功能在于交互式地浏览和修改数据,生成动态We ...