Created
January 22, 2014 07:37
-
-
Save kloon/8554848 to your computer and use it in GitHub Desktop.
Limit the width and height values customers can enter using Measurement Price calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Limit the values customer can enter using measurement price calculator area ( LxW ) option | |
add_action( 'wp_head', 'limit_measurement_values', 99 ); | |
function limit_measurement_values() { | |
if ( is_product() ) { | |
?> | |
<script> | |
jQuery( document ).ready(function() { | |
jQuery( '#length_needed' ).change( function() { | |
if ( jQuery( this ).val() > 100 ) jQuery( this ).val( 100 ).keyup(); | |
}); | |
jQuery( '#width_needed' ).change( function() { | |
if ( jQuery( this ).val() > 100 ) jQuery( this ).val( 100 ).keyup(); | |
}); | |
}); | |
</script> | |
<?php | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mitchpowell, to lock the aspect ratio, you could try this:
}
?>