1

How to disable a button when the input field is empty? im trying really hard but i'm bad in javascript... :(, so could someone please help me out? because i'm making a schoolproject for a customer

my code is the following:

    <div class="formplacement">
    <!-- The form -->
                    <div class="col-xs-12">
                      <p class="formtekst"> Gegevens </p>
                    </div>
                    <form>
                      <div class="form-group">
                        <div class="form-check"> Aanhef:
                          <label class="form-check-label">
                            <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> Mr </label>
                          <label class="form-check-label">
                            <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> Mvr </label>
                          <label class="form-check-label">
                            <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> anders </label>
                        </div>
                      </div>
                    </form>
                    <div class="form-group">
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="Voornaam&#42; "> </div>
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="Achternaam&#42;   "> </div>
                    </div>
                    <div class="form-group">
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="E-mail&#42;   "> </div>
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="Telefoonnummer"> </div>
                    </div>
                    <div class="col-xs-12 reset">
                      <p class="formtekst"> Bezorgadres </p>
                    </div>
                    <div class="form-group">
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="plaats&#42;   &#42;   "> </div>
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="postcode&#42; "> </div>
                    </div>
                    <div class="form-group">
                      <div class="col-xs-12 col-sm-6">
                        <input type="email" class="form-control" placeholder="straatnaam&#42;"> </div>
                      <div class="col-xs-12 col-sm-3">
                        <input type="email" class="form-control" placeholder="huisnummer&#42;   "> </div>
                        <div class="col-xs-12 col-sm-3">
                        <input type="email" class="form-control" placeholder="toevoeging"> </div>
                        <div class="col-xs-12">
                        <p class="verplicht">onderdelen met een * zijn verplicht</p>
                      </div>
                <!-- buttons -->
                    <div class="winkelwagenknoppen">
                      <div class="col-sm-6 padding-knop">
                        <a href="#">
                          <button class="winkelwagen-knop">Terug</button>
                        </a>
                      </div>
                      <div class="col-sm-6 padding-knop">enter code here
                        <a href="#">
                          <button class="winkelwagen-knop2">Verder</button>
                        </a>
                      </div>
                    </div>
  • Maybe checkout [this](http://stackoverflow.com/questions/7067005/disable-button-whenever-a-text-field-is-empty-dynamically) link I think this will help you out. – Erwin Vorenhout Apr 03 '17 at 12:19
  • Welcome to [so]! Looks like you need to learn more about what is expected of users here. You're expected to try to **write the code yourself**. After **[doing more research](//meta.stackoverflow.com/questions/261592)** if you have a problem you can **post what you've tried** with a **clear explanation of what isn't working** and providing a [**Minimal, Complete, and Verifiable example**](//stackoverflow.com/help/mcve). I suggest reading [ask] a good question and [the perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/). Also, be sure to take the [tour]. – John Conde Apr 03 '17 at 12:20

0 Answers0