0

Could you help me with my post-form? I am gonna try realised reseting form after closing modal window with message about sending, but it isn't working! Why? I'm using Bootstrap 3.

<form id='send-form' action="#" method="post" target="iframe1">
    <div class="input-field">
        <input type="text" name="name" class="form-control" placeholder="name">
    </div>
    <div class="input-field">
        <input type="email" name="email" class="form-control" placeholder="e-mail...">
    </div>
    <div class="input-field">
        <input type="text" name="subject" class="form-control" placeholder="Тема...">
    </div>
    <div class="input-field">
        <textarea name="message" class="form-control" placeholder="message"></textarea>
    </div>
    <div class="input-field">
        <input type="checkbox" checked autocomplete="on" name="law">check</input>
    </div>
    <button type="submit" id="submit" class="btn btn-blue btn-effect" data-toggle="modal" 
    data-target="#modal-send">send</button>

</form>

<div class="modal" id="modal-send">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button id='reset-but' class="close" type="button" data-dismiss="modal">
                <i class="fa fa-close fa-2x"></i></button>
                <script>
                    $(index.html).ready(function(){
                    $('#reset-but').click(function () {
                    $('#send-form')[0].reset();
                    });});
                </script>
                <h4 class="modal-title">Сообщение отправлено<br><br></h4>
            </div>
       </div>
    </div>
</div>
Volkan Akın Paşa
  • 364
  • 2
  • 3
  • 18

1 Answers1

1

Just delete $(index.html).ready(function(){} and it will works

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id='send-form' action="#" method="post" target="iframe1">
    <div class="input-field">
        <input type="text" name="name" class="form-control" placeholder="name">
    </div>
    <div class="input-field">
        <input type="email" name="email" class="form-control" placeholder="e-mail...">
    </div>
    <div class="input-field">
        <input type="text" name="subject" class="form-control" placeholder="Тема...">
    </div>
    <div class="input-field">
        <textarea name="message" class="form-control" placeholder="message"></textarea>
    </div>
    <div class="input-field">
        <input type="checkbox" checked autocomplete="on" name="law">check</input>
    </div>
    <button type="submit" id="submit" class="btn btn-blue btn-effect" data-toggle="modal" data-target="#modal-send">send</button>

</form>

<button id='reset-but' type="button" data-dismiss="modal">
<i class="fa fa-close fa-2x"></i></button>
<script>
$('#reset-but').click(function () {
$('#send-form')[0].reset();
});
</script>
<h4 class="modal-title">Сообщение отправлено<br><br></h4>
Zhenya Telegin
  • 589
  • 2
  • 9