You need to sign in to do that
Don't have an account?
Zander Zumbrunnen
LWC: check if event.target.value is blank
Hello all,
So I have a small lwc where I want to enable a button when an input is not empty but I can not seem to get it to disable the button again if the value in the input field is deleted.
Methods I have tried:
event.target.value == undefined
event.target.value == null
event.target.value.length < 1
I imagine this is possible so I must be missing some key information about event.target.value.
Any help or infromation would be very helpful!
Thanks in advance.
So I have a small lwc where I want to enable a button when an input is not empty but I can not seem to get it to disable the button again if the value in the input field is deleted.
Methods I have tried:
event.target.value == undefined
event.target.value == null
event.target.value.length < 1
I imagine this is possible so I must be missing some key information about event.target.value.
Any help or infromation would be very helpful!
Thanks in advance.
Try the below Code Please Mark it As Best Answer if it Helps
Thank You!
All Answers
Try the below Code Please Mark it As Best Answer if it Helps
Thank You!
find the below solution
if you find this helpful mark it as the best answer
thanks, Regards,
Malika Pathak
if ( this.myTextField == '' ){
alert( 'empty text box' )
}
@Malika Pathak 9 has a worng : if condition - || this.fieldValue.length>0)