Skip to content

Instantly share code, notes, and snippets.

@carolineschnapp
Created June 8, 2011 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carolineschnapp/1014941 to your computer and use it in GitHub Desktop.
Save carolineschnapp/1014941 to your computer and use it in GitHub Desktop.
tiered-pricing.liquid
<script>
if (typeof jQuery === 'undefined') {
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"><\/script>');
document.write('<script type="text/javascript">jQuery.noConflict();<\/script>');
}
</script>
{% if needs_update %}
<script type="text/javascript">
jQuery('form[action="/cart"]').get(0).submit();
</script>
{% endif %}
<script type="text/javascript">
jQuery(function() {
jQuery(':text[name^=updates]').change(function() {
var min = parseInt(jQuery(this).attr('min'), 10) || 0;
var max = parseInt(jQuery(this).attr('max'), 10) || 9999999;
var qty = parseInt(jQuery(this).val(), 10);
if (qty < min) {
jQuery(this).val(min);
}
else if (qty > max) {
jQuery(this).val(max);
}
return true;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment