I have a form, an input and a link. If the input has no value, clicking the link would direct to a certain url. If the input is NOT empty, then the click would have to submit the form. This is how the link looks like:
<li class="youtube"><a href="#">YouTube</a></li>
This is what I have so far in Jquery:
$('.youtube').bind('click', function() {
if($(input).val() == ''){
$(".youtube a").attr("href", "http://www.youtube.com/")
}else{
$(form).attr("action","http://www.youtube.com/results?search_query=");
$(form).submit();
}
});
This doesn't work, I can't figure out why.