I have a search box built in JQuery that displays a dynamic window, that only works when you click the little "Go" button.
If you hit enter on the keyboard, the js thinks you're hitting the 'search' button of the dynamic window instead. I was wondering if anyone could help me with this.
Here is the link to live
http://goo.gl/A0LRu
and here is the code. I can't seem to figure out the problem.
Code:
<script>
jQuery('#quick-search-form a.button').click(function(){
var symbol = jQuery('#symbol').val();
if (symbol != "") {
jQuery('#popout').show();
jQuery('#quick-search-form .error');
} else {
jQuery('#quick-search-form .error').remove();
jQuery('#quick-search-form').append('<div class="error">Symbol required</div>');
}
return false;
});
jQuery('#quick-search-form a.close').click(function() {
jQuery('#popout').hide();
});
jQuery('#quick-search-form form').submit(function() {
jQuery('label', this).removeClass('error');
var do_search = true;
if (jQuery('select[name="category"]', this).val() == '') {
jQuery('label[for="category"]', this).addClass('error');
jQuery('.required', this).show();
do_search = false;
}
if (jQuery('select[name="subcategory"]', this).val() == '') {
jQuery('label[for="subcategory"]', this).addClass('error');
jQuery('.required', this).show();
do_search = false;
}
if (jQuery('select[name="expected_deviation"]', this).val() == '') {
jQuery('label[for="expected_deviation"]', this).addClass('error');
jQuery('.required', this).show();
do_search = false;
}
if (jQuery('select[name="expected_outlook"]', this).val() == '') {
jQuery('label[for="expected_outlook"]', this).addClass('error');
jQuery('.required', this).show();
do_search = false;
}
return do_search;
});
</script>