[Vuejs]-Using Vue.js I am getting strange behavior in the two methods tied to click events on two buttons, Save and Delete

0👍

Ok, the solution was in the two lines with the buttons.

<div class="flex items-center gap-8">           
                    <button class="btn-warning mt-4" @click="this.deleteInstruction(editInstruction)">Delete Instruction</button>
                    <button type="submit" class="btn-primary mt-4" @click='saveEditInstruction'>Save Instruction</button>
                </div>

Changed to

<div class="flex items-center gap-8">           
                    <button type="button" class="btn-warning mt-4" @click="this.deleteInstruction(editInstruction)">Delete Instruction</button>
                    <button type="submit" class="btn-primary mt-4" @click='saveEditInstruction'>Save Instruction</button>
                </div>

Apparently not having the type="button" let it cascade to the save submit method.

Leave a comment