javascript - How to pass javascript/jQuery script in dsp param tag
问题描述
I am using ATG
and I'm passing dsp include
tags, where inside I'm passing dsp param
tags
<div id="page1">
<span id="nameVal"></span>
<dsp:include page="/name.jsp">
<dsp:param name="age" value="${currentAGE}" />
<dsp:param name="name" value="" />
</dsp:include>
</div>
and In my jQuery
file, I am writing as -
if($("#page1").length > 0){
$('#nameVal').text('akshay');
}
I want to access the nameVal value which I'm getting from jQuery in <dsp:param name="name" value="" />
as soon as my page1
div loads.
If the dsp include tags can be accessed after the page load and then access the data it can also work. Please help.
解决方案
Try selecting by the name attribute and setting the value with val()
:
if($("#page1").length > 0){
$('#page1 [name="name"]').val('akshay');
}
推荐阅读
- dataset - 我在哪里可以获得数据集来识别任何植物的雄花和雌花?
- scala - 参数无法定位到正确的文件
- python - 如何通过电报python api获取消息的消息ID
- java - Spring Boot:spring-starter-web 的用途
- vaadin - LitElement:如何在 vaadin 叠加层中填充插槽
- c# - 如何解决 xamarin 错误 ConnectFailure?
- javascript - 由于 CORS 问题,无法发出 POST 请求
- python - 当我打印我的 list[int] 的一个元素时,它打印为 [1] 如何删除括号,使其只是数字(将 list[int] 转换为 int)-Python
- kubernetes - 用于 rego 策略的 Template.yaml 和 constraint.yaml
- javascript - Javascript 显示来自本地存储阵列的数据问题