V9द's avatar
Level 3

Each loop in vue js

Hello all I'm new to vuejs, So I Want to know How can we do this in vuejs

$.each($(".input-check-association"), function(){
        $(this).prop("disabled", false);
        $(this).prop("checked", false);
});
0 likes
5 replies
bobbybouwmann's avatar

What have you tried so far?

Also in vue you work with v-model where your input is connected to some data attribute.

Here is a small example of how you can disable a button in this case, but that's the same as an input: https://codepen.io/oomusou/pen/mVNVrL

V9द's avatar
Level 3

@bobbybouwmann Thanks for your reply. I have multiple checkbox which are coming dynamically as shown below

@foreach($destinations as $destination)
    <div class="input-check">
        <input type="checkbox" id="{{$destination['id']}}" class="input-check-association check-{{$destination['id']}}" v-model="destination_check" value="{{$destination['id']}}">
        <label for="{{$destination['id']}}">{{$destination['name']}}</label>
    </div>
@endforeach
bobbybouwmann's avatar

@v9द They all have the same "v-model" name, that should be unique as well!

V9द's avatar
Level 3

@bobbybouwmann if we provide unique v-mod to all checkboxs which are generated dynamically than, How we could manage these ? Please provide me some details if you could. Right now I'm using this as given below

data() {
return {
destination_check: [],
}
}

Please or to participate in this conversation.