Events (keyup & change)
See original GitHub issueversion - v2.0.0-rc.6 change
<template>
<div>
<b-form-select v-model="selected" :options="options" class="mb-3" />
<b-form-select v-model="selected" :options="options" class="mb-3" size="sm" @change="log(selected)" />
<div>Selected: <strong>{{ selected }}</strong></div>
</div>
</template>
<script>
export default {
data () {
return {
selected: null,
options: [
{ value: null, text: 'Please select an option' },
{ value: 'a', text: 'This is First option' },
{ value: 'b', text: 'Selected Option' },
{ value: {'C': '3PO'}, text: 'This is an option with object value' },
{ value: 'd', text: 'This one is disabled', disabled: true }
]
}
},
methods: {
log (val) {
console.log(val)
}
}
}
</script>
As you see, model in template change correct, but in console log old value.
keyup
<template>
<div>
<b-form-input v-model="text1"
type="text"
placeholder="Enter your name"
@keyup.enter="log('b-form-input')"></b-form-input>
<input v-model="text1"
type="text"
placeholder="Enter your name"
@keyup.enter="log('simple input')"/>
<p>Value: {{ text1 }}</p>
</div>
</template>
<script>
export default {
data () {
return {
text1: ''
}
},
methods: {
log (val) {
console.log(val);
}
}
}
</script>
keyup works only in simple input.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
jQuery: Do I need both keyUp and change events?
When do you want the values to update? change and keyup are different events, and you might use both of them. – Bergi....
Read more >jQuery keyup() Method - W3Schools
The order of events related to the keyup event: ... The keyup event occurs when a keyboard key is released. The keyup() method...
Read more >.keyup() | jQuery API Documentation
The keyup event is sent to an element when the user releases a key on the keyboard. It can be attached to any...
Read more >jQuery keyup change event - CodePen
1. var keyup_count = 0; ; 2. var change_count = 0; ; 3. $('#input1').keyup(function(){ ; 4. keyup_count++; ; 5. $('#log_keyup').html('keyup:'+keyup_count).
Read more >jQuery - text input field - change keyup and paste events
jQuery can be used to handle these events on an input text field. change (when text input field changes and loses focus)
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi, try to use @keyup.enter.native, and please let us know the result
@Hanyuusha You’re welcome. Please close the issue.