getting blank input value on keydown event in fluent ui seachbox #28427
-
Hi Team I am trying to get input value from fluent ui searchbox using onkeydown event. but some how i am always getting an blank value. I am simply using the onkeyDown prop from the searchbox like this <SearchBox onKeyDown={(e)=>{alert(e.currentTarget.value)}}> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @sagarkalokhe09, is this the v8 SearchBox? https://developer.microsoft.com/en-us/fluentui#/controls/web/searchbox The <SearchBox onChange={(_ev, value) => console.log(value)} /> |
Beta Was this translation helpful? Give feedback.
Hi @sagarkalokhe09, is this the v8 SearchBox? https://developer.microsoft.com/en-us/fluentui#/controls/web/searchbox
The
onKeyDown
event happens before the value is updated. Consider using theonChange
event instead. That also has a second parameter, which is the new value. See the documentation on the link above.