当我尝试从页面加载使用jquery的表单属性中获取值我正在获取Java脚本错误,“对象不支持此属性或方法“。让我知道这个问题。对象不支持此属性或方法错误Jquery
alert($("[name=searchAttribute.brand.attributeValue]").val());
我使用的是struts2和Jquery。 内部行动我有searchAttribute作为ValueObject属性在这里我有品牌作为另一个,它内部它有attributeValue作为另一个属性。
我需要在页面加载时根据此值加载下拉列表。
<script type="text/javascript">
$(document).ready(
function() {
fetchDropDownValues($("#idGMMHouse").val(),'<s:property value="brandloadUrl"/>','idGMMBrand','idGMMLine');
var fieldname = '';
alert($("[name="+ 'searchAttribute.brand.attributeValue' +"]").val());
});
</script>
<tr>
<td width="80px"><s:text name="filter.price.gmmhouse" /></td>
<td width="1px"><s:text name="filter.colon" /></td>
<td width="270px"> <s:select cssClass="drop" tabindex="1"
listKey="code" listValue="value" headerKey="0"
headerValue="Select One"
onchange="fetchDropDownValues(this.value,'%{brandloadUrl}','idGMMBrand','idGMMLine');" id="idGMMHouse"
name="searchAttribute.house.attributeValue" list="lstGMMHouse"></s:select></td>
<td width="80px"><s:text name="filter.price.gmmbrand" /></td>
<td width="1px"><s:text name="filter.colon" /></td>
<td width="160px"><s:url action="loadGMMLineDropDown"
id="lineloadUrl"></s:url><s:select cssClass="drop" tabindex="1"
id="idGMMBrand"
onchange="fetchDropDownValues(this.value,'%{lineloadUrl}','idGMMLine');"
headerKey="0" headerValue="Select One"
name="searchAttribute.brand.attributeValue" list="{}"></s:select></td>
<td width="80px"><s:text name="filter.brand.desc" /></td>
<td width="1px"><s:text name="filter.colon" /></td>
<td width="270px"><s:select cssClass="drop" tabindex="1"
id="idGMMLine" headerKey="0" headerValue="Select One"
name="searchAttribute.line.attributeValue" list="{}"></s:select></td>
<td align="LEFT"> </td>
</tr>
发布你的'html'和'js'代码相关的问题 – thecodeparadox
你可以试试'$(“input [type = select] [name ='searchAttribute.brand.attributeValue']”)'? – MilkyWayJoe
现在错误发生时,我把它作为警报($(“[name ='searchAttribute.brand.attributeValue']”)。val());但我无法获得价值。它只显示0. – Jothi