I have this function:
jQuery('#sort_order_by').change(function(){
var productUrl = 'product.phtml';
var value = jQuery(this).val();
jQuery.cookie('sortorderby', value);
var url= productUrl + '?sort_by='+ value;
window.location.href = url;
jQuery('#sort_order_by').val(jQuery.cookie('sortorderby') || 'helpful' );
});
When executed, jQuery.cookie('sortorderby')
has value jQuery('#sort_order_by').val()
not set value of
jQuery.cookie('sortorderby')
.
I think that after the location load it does not re-run the code. So I tried create:
`function jQuery(function {jQuery('#sort_order_by').val(
jQuery.cookie('sortorderby') || 'helpful' );});`
This gives an error, jQuery.cookie not function.
Can anyone help?