I have a input field with class "kind" and link/button with class "submit".
Now I wanna disable this "kind" input on click of button "submit" if there is no value in input, or if you wanna say, if input is empty...
I tried like this:
html:
<input class="kind" id="name" name="name" type="text" placeholder="Kind">
<a href="#" class="submit" >Submit</a>
script:
$('.submit').click(function () {
if ($('.kind').val().length != 0) {
$('.kind').prop('disabled', true);
}
});
but it does not work, and I don't know why, you can see here: http://jsfiddle.net/dzorz/UBy4x/
am I missing something? or should I define value check differently..