How can i add required field while creating a form?

前端 未结 2 1423
囚心锁ツ
囚心锁ツ 2020-12-12 06:50

This is my code :

  
2条回答
  •  死守一世寂寞
    2020-12-12 07:11

    You need to check it with your next_button using jquery

      
    {!! Form::input('number', 'mobile', null, ['type' => 'number', 'min' => 0, 'id' => 'mobile', 'class' => 'input-lg form-control TabOnEnter', 'placeholder' => 'Eg: 9876543210', 'tabindex' => 15]) !!}
    $(document).ready(function(){ $('.next_button').click(function(event){ if ($('#mobile').val() == ""){ event.preventDefault(); alert('Enter the number'); } }); });

    Added next_button class in your existing code

提交回复
热议问题