New Jan 20, 2026

vue 3 JS unselect all 'selected' options on a form on click

Libraries, Frameworks, etc. All from Newest questions tagged vue.js - Stack Overflow View vue 3 JS unselect all 'selected' options on a form on click on stackoverflow.com

I have several select options inputs on a form. I want to 'unselect' all selected option on the click of a button.

jquery has a method for this.

$("option:selected").removeAttr("selected"); 

is there a similar way to do this in vue.

these are my select options:

<template>
<form id="myform">
<select  @change="clearOptions($event)" id="mySelect">
  <option>Pineapple</option>
  <option>Banana</option>
</select>

<select @change="clearOptions($event)" id="mySelectTwo"> <option>Apple</option> <option>Orange</option> </select> </template>

<script setup> const clearOptions = (e) => { e.preventDefault() $("option:selected").removeAttr("selected"); }

</script>

Scroll to top