/ Published in: jQuery
If on do nothing. If on make off. If off make on. Alter external value and focus.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var searchHiddenSort; $('.ukn-search-sort a').click(function(e) { if ($(this).hasClass('ukn-search-sort-selected')) { return false; } var text = $(this).text(); e.preventDefault(); $('.ukn-search-sort-date, .ukn-search-sort-relevance').removeClass('ukn-search-sort-selected'); $(this).addClass('ukn-search-sort-selected').parents('fieldset').find('.ukn-search-box input').focus(); $(".ukn-form-hidden-search-sort").val(text); if(searchHiddenSort) return; searchHiddenSort = true; $('.ukn-search fieldset').prepend('<input class="ukn-form-hidden-search-sort" type="hidden" name="sort" value=' + text + ' />'); });