Js On load Page Change Input Min Value

Viewed 202

i want to inpde.ut min value change with js onload.

This code i'm try but not work.

<script type="text/javascript">$(document).ready(function(){
    $("#quantity_5c27c535d66fc").min('10');
});</script>

My input code;

<input type="number" id="quantity_5c27c535d66fc" class="input-text qty text" step="10" min="1" max="" name="quantity" value="1" title="Miktar" size="4" pattern="[0-9]*" inputmode="numeric" aria-labelledby="">

min value change etc 5

2 Answers

Try this:

<script type="text/javascript">
  $(document).ready(function(){ 
    $("#quantity_5c27c535d66fc").min=10;
  });
</script>

I hope this will help!

To me the working solution is:

$(document).ready(function() {
    $('#quantity_5c27c535d66fc').attr({
       'min': 2,
    });
});

jQuery uses a bit different approach here, using attr function.

Related