为什么模拟点击提交不起作用
Why simulate click on submit doesn't work
我尝试了这个,许多其他仍然不起作用:
我需要在 Filemaker 的 Web 查看器中使用它(MBS( "WebView.RunJavaScript";网络查看器参考;Javascript ))
脚本 : $("#positiveButtonExpand borRad5 jq-picHover").click(function()
在网页上 :
<fieldset>
<label class="formLabelExpand">Rechercher par numéro de commande :</label>
<input class="formInputTextMedium resetValue floatLeft borRad5" id="id_1405652204_ScopusIdFilter" name="id_1405652204.ScopusIdFilter" type="text" value="saisissez le n° de la commande">
<button name="id_1__" type="submit" class="positiveButtonExpand borRad5 jq-picHover">OK</button>
</fieldset>
感谢您的所有回答和建议,没有人为我工作,我认为它来自网站或文件制作者。 :)
positiveButtonExpand是一个类而不是一个ID,你可以选择它.positiveButtonExpand
而不是#positiveButtonExpand
。
$(".positiveButtonExpand").click(function(){
// code
});
您需要使用以下任一方式选择该按钮:
$(".positiveButtonExpand.borRad5.jq-picHover")
或者更简单地说:
$(".positiveButtonExpand")
我在这里看到的第一件事是你在 ID 上调用处理程序,但在你的 html 中你把它作为一个类。例如:
按钮:class="positiveButtonExpand borRad5 jq-picHover"
Javascript: $("#positiveButtonExpand borRad5 jq-picHover")
Javascript 需要更改为
$(".positiveButtonExpand").click(function(){})
使用 JQuery 时,如果以"#"开始选择,则表示您正在查找 ID。
最好的方法是模拟真实用户点击。为此,这里有一个简短的脚本。
$.fn.simulateClick = function() {
return this.each(function() {
if('createEvent' in document) {
var doc = this.ownerDocument,
evt = doc.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, doc.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
} else {
this.click(); // IE
}
});
}
这允许创建一个本机鼠标事件,因此您只需像这样简单地调用函数即可。
$(".positiveButtonExpand").simulateClick();
希望对您有用:)
相关文章:
- 加载后的页面与ajax表单提交不起作用
- Onload提交不起作用
- PHP+AAJAX表单提交不起作用
- Jquery、AJAX&PHP,表单提交不起作用
- jQuery表单验证validate()验证后提交不起作用
- Ajax表单提交不起作用
- 从jQuery提交不起作用
- jquery/ajax表单提交不起作用
- 添加代码以防止重复提交 JQuery 后提交不起作用
- 为什么模拟点击提交不起作用
- Ajax 表单提交不起作用
- HTML5表单按钮提交不起作用
- jQuery 和扩展 [提交不起作用]
- 表单未提交或按钮提交不起作用
- “返回假;”,因为表单提交不起作用
- ng提交不起作用
- 表单动态属性更改和提交不起作用
- 当表单具有id为'的提交按钮时;提交'值,表单提交不起作用
- Jquery表单提交不起作用
- 电子邮件提交不起作用