<div id="container">
<form id="form" name="form1">
<input type="text" name="txtbox" value="Enter something" />
<input name="salam" type="Submit" id="submitbtn" name="Submit" />
</form>
</div>
<div id="container1">
<form id="form1" name="form1">
<input type="text1" name="txtbox1" value="Enter something" />
<input name="salam1" type="Submit" id="submitbtn1" name="Submit" />
</form>
</div>
$(document).ready(function(){
$('#form').submit(function(){
$('input[id=submitbtn1]', this).attr('disabled', 'disabled');
});
});
答案 0 :(得分:1)
$(document).ready(function(){
$("#form").submit(function (event){
event.preventDefault();
});
});
答案 1 :(得分:1)
在纯JavaScript中也很容易:
document.getElementById('submitbtn1').disabled = true;
OR
document.getElementById('submitbtn1').readOnly = true;
答案 2 :(得分:0)
答案 3 :(得分:0)
$(document).ready(function(){
$('#form').submit(function(){
$('#submitbtn1').attr('disabled', true);
});
});
如果你只想在提交id = form
的表单时禁用id = submitbtn1的按钮答案 4 :(得分:0)
这会在不等待提交
的情况下禁用它
$(document).ready(function(){
$('#submitbtn1').attr('disabled', true);
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="container">
<form id="form" name="form1">
<input type="text" name="txtbox" value="Enter something" />
<input name="salam" type="Submit" id="submitbtn" name="Submit" />
</form>
</div>
<div id="container1">
<form id="form1" name="form1">
<input type="text1" name="txtbox1" value="Enter something" />
<input name="salam1" type="Submit" id="submitbtn1" name="Submit" />
</form>
</div>
&#13;
答案 5 :(得分:0)
也是这个
$('input[id=submitbtn1]', this).attr('disabled', true);
答案 6 :(得分:0)
试试这个
$(document).ready(function(){
$('#submitbtn1').attr('disabled', true);
});