setting a min. value

how do i set a minimum value


this is the code i used-

function addquantity() {
	$w("#input12").value++;
	errorcontrol();
}

function negitivequantity() {
	$w("#input12").value--;
	errorcontrol();
  } 

and tried this method but it doesn’t work even though the code is fine.

function errorcontrol() {
	if($w("#input12").value<1) {
		
        $w("#quantitytext").hide;
        $w("#price").hide;
        $w("#error").show;
	    $w("#error2").show;
	  }  else {
	  	
	    $w("#quantitytext").show;
        $w("#price").show;
        $w("#error").hide;
	    $w("#error2").hide;
	    }
}

i have an onClick event that runs these function