Hello,
As title states, i have a DropdDown and i need to stop user submitting form if he hasn't selected anything in Dropdown
i am using (for testing purpose)
and it return 0 if nothing selected and length of selected option (if selected), but when i use same command in If like
this always shows the alert message irrespective of if user has selected anything in Dropdown or not. but first alert shows correct value.
Can somebody please help me where i am going wrong, Its something very minor and frustating.
Any help will be appreciated.
Regards
As title states, i have a DropdDown and i need to stop user submitting form if he hasn't selected anything in Dropdown
i am using (for testing purpose)
Code:
alert($("#DivId option:selected").val().length);
Code:
if ($("#DivId option:selected").val().length == 0); { alert('please choose dropdown 2'); return false; }
Can somebody please help me where i am going wrong, Its something very minor and frustating.
Any help will be appreciated.
Regards
Comment