我想在提交之前设置一个必需的,但不工作的任何想法?可能超过JS?谢谢你的支持

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<tr><td><input type="text" size"30" placeholder="Text " maxlength="10" id="source" required>
<button type="submit" class="formButton" id="submit">Submit</button></td></tr>

<tr><td height="20px"></td></tr>
<tr><td><input type="text" style="border:none" size="40" id="target" class="form69" onClick="myFunct()"></td></tr>
<tr><td height="150px"></td></tr>

<script>
$(".formButton").click(function() {
 $(".form69").show();
});
</script>

<script>
$('#submit').click(function(){
var source = $('#source').val();
$('#target').val('text test' + source + ' text');
});
</script>

最佳答案

您没有表单标记。添加如下表单标记:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
<tr><td><input type="text" size"30" placeholder="Text " maxlength="10" id="source" required>
<button type="submit" class="formButton" id="submit">Submit</button></td></tr>
</form>

<tr><td height="20px"></td></tr>
<tr><td><input type="text" style="border:none" size="40" id="target" class="form69" onClick="myFunct()"></td></tr>
<tr><td height="150px"></td></tr>

<script>
$(".formButton").click(function() {
 $(".form69").show();
});
</script>

<script>
$('#submit').click(function(){
var source = $('#source').val();
$('#target').val('text test' + source + ' text');
});
</script>

10-01 10:24