Within my HTML code, I have the following:
<div class="pl_wrapper">
<div class="options_pl">
<input type="button" @click="optionButtonClicked" class="option_button_pl" value="List">
<input type="button" @click="optionButtonClicked" class="option_button_pl" value="Add a language">
</div>
{{show2}}
</div>
In my Vue.js file, I have the following:
const ProgrammingLanguages = new Vue({
el:".pl_wrapper",
data:{
name: "aa",
show1: false,
show2: false
},
methods: {
optionButtonClicked(){
var indexOfClicked = index(event.target,event.target.className);
var equalIndexOfDiv = getOnIndex(indexOfClicked,"pl_divs")
$(".options_pl").hide();
show1 = (indexOfClicked==0) ? true : false
show2 = (indexOfClicked==1) ? true : false
}
}
});
When clicking on option_button_pl
, I expect that {{show2}}
will change from false to true and vice versa. However, this is not happening as expected. Here is the Jsfiddle link for reference: https://jsfiddle.net/3akfzcyf/