Check if selected dropdown value is empty using jQuery -
There is a dropdown in question:
& lt; Choose Name = "Data" Category = "Autotyim" ID = "EventStart Timeman" & gt; & Lt; Option value = "" & gt; & Lt; / Options & gt; & Lt; Option value = "00" & gt; 00 & lt; / Options & gt; & Lt; Option value = "10" & gt; 10 & lt; / Options & gt; & Lt; Option value = "20" & gt; 20 & lt; / Options & gt; & Lt; Option value = "30" & gt; 30 & lt; / Options & gt; & Lt; Option value = "40" & gt; 40 & lt; / Options & gt; & Lt; Option value = "50" & gt; 50 & lt; / Options & gt; & Lt; / Select & gt; What I want to do is check whether the current value is empty:
if ($ ("EventStartTimeMin"). val () = == "") {// ...} But this does not work, even if the value is empty. Any help is greatly appreciated.
You forgot # on the id selector: < pre> if ($ ("# EventStartTimeMin"). Val () === "") {// ...}
Comments
Post a Comment