ItSolutionStuff.com

Vue JS Get Checked Radio Button Value on Onchange Event

By Hardik Savani • November 5, 2023
Vue.JS

Hi Developer,

I will show you how to get selected radio button value using onchange event in vue js. i will give you simple example of get get checked radio button value vue js.

we can easily get selected text value of radio buttons in vue js. i give you bellow full example of getting selected radio buttons text and value in vuejs.

In this example, we will take a simple radio buttons with some options like laravel, php, codeigniter, etc. when you select it. we will get selected radio button text and value using on change event value vue js.

Example:

<!DOCTYPE html>

<html>

<head>

<title>Vue JS Get Checked Radio Button Value on Onchange Event - ItSolutionStuff.com</title>

<script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>

<body>

<div id="app">

<label><input type="radio" name="category_id" @change="onChange($event)" class="form-control" value="1"> Laravel</label>

<label><input type="radio" name="category_id" @change="onChange($event)" class="form-control" value="2"> Codeigniter</label>

<label><input type="radio" name="category_id" @change="onChange($event)" class="form-control" value="3"> Vue JS</label>

</div>

<script type="text/javascript">

var app = new Vue({

el: '#app',

methods: {

onChange(event) {

var optionText = event.target.value;

console.log(optionText);

}

}

})

</script>

</body>

</html>

I hope it can help you...

Tags: Vue.JS
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Use Ternary Operator in Vue JS?

Read Now →

How to Define Global Variables in Vue JS?

Read Now →

How to Get Data Attribute Value in Vue JS?

Read Now →

How to Get Query String Parameters in Vue JS?

Read Now →

How to Download File using Axios Vue JS?

Read Now →

Vue JS Get Dropdown Selected Value Example

Read Now →