すべてのフィールドと塗りつぶし/選択した場合にのみ、送信ボタンをアクティブにする必要があります。JSでいくつかの関数を結合するには?
私はいくつかの例を見ましたが、それを行う方法はわかりません!!
$(document).ready(function()
{
\t $('.envia').prop('disabled',true);
\t $('#matricula').on('change', function()
\t {
\t \t $('#envia').prop('disabled', !$(this).val());
\t \t
\t }).trigger('change');
});
$(document).ready(function()
{
\t $('.envia').prop('disabled',true);
\t $('#peca').on('change', function()
\t {
\t \t $('#envia').prop('disabled', !$(this).val());
\t \t
\t }).trigger('change');
});
$(document).ready(function()
{
\t $('.envia').prop('disabled',true);
\t $('#quilometros').keyup(function()
\t {
\t \t $('#envia').prop('disabled', !$(this).val());
\t }).trigger('change');
});
$(document).ready(function()
{
\t $('.envia').prop('disabled',true);
\t $('#data').keyup(function()
\t {
\t \t $('#envia').prop('disabled', !$(this).val());
\t }).trigger('change');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<form action="#">
<select id="matricula">
<option></option>
<option value="1">Matricula 1</option>
<option value="2">Matricula 2</option>
</select>
<select id="peca">
<option></option>
<option value="1">Peca 1</option>
<option value="2">Peca 2</option>
</select>
<input type="text" id="quilometros">
<input type="text" id="data">
<input type="submit" id = "envia" value="ok"></input>
</form>
要素をチェックして値が元の値から変更されたかどうかを確認し、すべての要素が変更されている場合は、ボタンを有効にする「検証」関数を作成します。次に、すべての要素などのイベントハンドラでその関数を呼び出します。 – adeneo