target data option select vue js
methods:{
onChange: function(e){
var id = e.target.value;
var name = e.target.options[e.target.options.selectedIndex].text;
console.log('id ',id );
console.log('name ',name );
},
<select name="customerName" id="" v-on:change="onChangeSite($event)">
<option value="1">Jan</option>
<option value="2">Doe</option>
<option value="3">Khan</option>
</select>methods: {
handleChange(e) {
if(e.target.options.selectedIndex > -1) {
console.log(e.target.options[e.target.options.selectedIndex].dataset.foo)
}
}
}
Also in JavaScript:
- js select element by css selector
- javascript if array key exists
- jquery fade out
- react class and props example
- jquery multiple div click
- How can I upload files asynchronously
- packages.json from file
- js maths
- The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object. scoop
- moment check valid date
- pull out only text from element javascript
- javascript format date yyyy-mm-dd
- jquery disable keypress
- react chunk file too large
- what is jsonwebtoken
- get start of day javascript
- get a element using name in jquery
- jquery redirect to url
- update cypress
- javascript switch assignment
- javascript date difference in months
- asp net core use newtonsoft json
- lodash pascal case
- ajax laravel get values from form