0

I am trying to find a way to activate a button when both of those checkboxes are checked. I've disabled the button but I can't think of a method of actually triggering the isActive when both of them are checked.

<div class="form-check mb-1">
    <input
        class="form-check-input"
        type="checkbox"
        id="age"
        checked
    />
    <label
        class="form-check-label"
        for="age"
        >By clicking this you agree that you
        are at least 18 years old.</label
    >
</div>

<div class="form-check mb-4">
    <input
        class="form-check-input"
        type="checkbox"
        id="terms"
        checked
    />
    <label
        class="form-check-label"
        for="terms"
        >By clicking this you agree to our
        <router-link to="/terms"
            >Terms & Conditions</router-link
        >
    </label>
</div>

<button
    :disabled="isActive"
    class="btn btn-outline-light btn-lg px-5 mb-1"
    type="submit"
>
    Register
</button>


<script>
export default {
    data() {
        return {
            isActive: true,
        };
    },
};
</script>

1 Answer 1

3

You should do something like

First checkbox

<input class="form-check-input" v-model="checkOne" type="checkbox" id="age" checked />

second checkbox

<input class="form-check-input" v-model="checkTwo" type="checkbox" id="age" checked />

button

<button :disabled="!checkOne || !checkTwo" class="btn btn-outline-light btn-lg px-5 mb-1" type="submit" >
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.