在jQuery的对话框中标准按钮就像对话框
问题描述:
的提交按钮我有一个按钮的行为问题:在jQuery的对话框中标准按钮就像对话框
它是一个jQuery标签内,jQuery的对话框里面,里面。
当点击按钮而不是执行一个函数时,它会验证表单来刷新页面并在我的数据库中插入一个新的空白条目。
我只是想要它在我告诉它的一个中添加一个新的。
的HTML:
<td colspan="2" align="center">
<button id="newgroup-anacuad">Añadir una fecha de fotos</button><br />
<div id="newgroup-divfotos"></div>
</td>
的JavaScript:
$('#diagnewgroup').dialog({
...
open:function(){
$("#newgroup-anacuad").button();
$("#newgroup-anacuad").bind("onclick",function(){
var txt='blabla';
$("#newgroup-divfotos").append(txt);
});
...
}
buttons:
{
'Validar':function()
{
var valid=true;
var errores='';
if(valid==true)
{
$('#formnewgroup').submit();
}
else
{
alert(errores);
}
},
'Cancelar':function()
{
$(this).dialog('close');
$('#diagnewgroup').remove();
}
}});
有谁以前遇到过吗?
答
尝试
<input type="button" id="newgroup-anacuad" value="Añadir una fecha de fotos"/>
更换
<button id="newgroup-anacuad">Añadir una fecha de fotos</button>
在某些浏览器
<button>
通常是作为
<input type="submit">
另外,你应该更换“点击”与在
$("#newgroup-anacuad").bind("onclick",function(){
var txt='blabla';
$("#newgroup-divfotos").append(txt);
});
“点击”或者你可以重写的东西,如:
$("#newgroup-anacuad").click(function(){
var txt='blabla';
$("#newgroup-divfotos").append(txt);
});
你有哪些浏览器的任何事实转换是否这样? – Tom
是的,这里http://www.w3.org/TR/html401/interact/forms.html#h-17.5按钮标签的默认'类型'值是'提交' – ViLPy
那么它有效地解决了提交问题,但功能仍然没有运行 – Jonah