I have this code in JS:
if($('.log input:checked'))
{
alert('login checked');
alert('do what you want');
}
else
{
alert('login not checked');
alert('you can not do what you want');
}
But it is not working correctly. IS the IF ELSE condition wrong?
You can use .is() in a jQuery fashion (it’s descriptive) and will return a boolean against the matched element.
But you can also use the JS
.lengthproperty.An even better solution (kindly suggested by @macek)