Im trying to get an alert when adding wrong parameters on items in simplecart. When the field is empty or if its lower then 400 of if it's higher then 500.
everything works, but not the alert when field is empty.
Html:
<input required max="500" min="400" type="number" class="item_width">
JavaScript:
<script>
simpleCart.bind( 'beforeAdd' , function( item ){
if( item.get( 'width' ) < '400'
|| item.get( 'width' ) > '500'
|| item.get( 'width' ) === 'null')
{
alert("Choose between 400 and 500");
return false;
}
});
</script>