我正在尝试使用 jQuery 获取视觉力元素并且遇到了一些麻烦。
在我的源代码中,我的保存按钮如下所示:
<apex:commandButton id="saveButton" value="Save"/>
在我的 document.ready 中,我有这样的声明:
alert('button value ' + $("[id$=saveButton]").value);
但是当我加载页面时,我得到的只是:
'按钮值未定义'。
最终,我想从 JavaScript 函数中以编程方式禁用该按钮,但我认为我什至无法抓取该元素。
chrome 检查员说我的元素如下所示:
<input id="j_id0:frm:searchBlock:saveButton" type="submit" name="j_id0:frm:searchBlock:saveButton" value="Save" onclick="saveButtonClicked();" class="btn" disabled="disabled">
有什么建议么?