小编Joh*_*ena的帖子

带有必填字段的表单 Onclick?

我目前有一个包含以下代码的表单,问题是当用户按下表单提交按钮时,即使没有检查必填字段,onclick呼叫仍然会被触发,我如何才能做到这一点,以便您必须完成必填字段在获得触发器之前?

<form method="post">
	<div class="form-group">
	<select id="inputState" class="form-control" style="width: 100%">
		<option>10,000 credits</option>
		<option>25,000 credits</option>
		<option>50,000 credits</option>
		<option>75,000 credits</option>
		<option>100,000 credits</option>
	</select>
	</div>
	<div class="text-center">
	<div class="row justify-content-center mb-2">
	<div class="col-12 col-md-8 text-center">
	<p class="mb-0 small text-muted"><strong>Promotion Disclaimer</strong>
	<br>You will be required to install a free mobile app from our sponsors to receive your Coins for free. This process only takes a minute or two and you can remove the app once you're finished.</p>
	</div>
	</div>
	<div …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

6
推荐指数
2
解决办法
1944
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1