datePicker border color (kinda Solved with workaround)

I have a date picker element on my page with a black border. I want the boarder color to change to red if the user does not select a date. I’m using the code below but it’s not working, anyone have a solution ?

if (($w(‘#datePicker’).value) === “”) {

            $w("#datePicker").style.borderColor = "rgba(255,0,0,0.5)"; 
            }

Hi Mike ,
To check if the user picked a value or not ( in a date picker ), the condition should be compared to null, so your code should look something like this :


if( $w("#datePicker").value == null) {
// your code is here
}

Hope this helps!
Best,

Mustafa

@ Mustafa Hammouz

I have changed to null as you have suggested but the border color of the date picker still does not change

@mikemoynihan99

Unfortunately, you cannot access the style. But what you can do instead,is to place a red box ( Hidden on load ) behind it ( and make it a bit bigger than the date picker ). now you can use the same condition to show and hide the red box ( red border )

@mhammouz

Ok but it wont look perfect as users will still be able to see the original black datePicker border along with the new red box border. Anyway thanks for the workaround, unusual we can’t access the .style for a datePicker in Wix as it pretty standard in javascript