the following code works fine on chrome but in fire fox. it only works once and then if I refresh the page it won't work again. any idea on how to fix that
<script type="text/javascript">
window.onload = new function() {
$(document).on('click', 'div', function() {
if ($(".ystq_buddy").hasClass("ystq_swipe-right") || $(
".ystq_buddy" ).hasClass( "ystq_swipe-left")) {
$(document.forms['f1']).submit();
}
});
};
</script>