How to leave disabled Ubmit and enable after the input text is larger than 10 real?

Asked

Viewed 46 times

-3

<form>
 <input type="text">
 <input type="submit" disabled>
</form>

I would like after filling a value for example 10.00 it enable and when it is less than 12.50 he disable and observation (the field is dynamic is a field of total (sum of products), it would have to be automatic when passing the value already enable the Submit)

  • First of all you have to figure out whether it’s more than 10 or 12.50

  • It would be 12.50 sorry!

  • complicated, rsrsrsrs, and if it is equal?

  • Not that, you have to post your code. Note that already closed your question

1 answer

1


function EnableSend() {

var a = document.getElementById('idInp').value;
//troca virgula por ponto
a = a.replace(/\,/g,'.'); 

if (a>(10)){
  document.getElementById("submit").disabled = false;
}else{
  document.getElementById("submit").disabled = true;
}

}
<form>
 <input id="idInp" type="text" onkeyup="EnableSend()">
 <input id="submit" type="submit" disabled>
</form>

  • Perfect! Only it would have to be with a comma because my script is adding up the values and appearing in this text with a comma

  • only make replace

  • Ixiii spoke English cmg, kkkkkk not manjo of javascript bro could give me only this light

  • a = a.replace(/,/g,'.');

  • It worked friend, more where is the 10 could be 12,50?

  • Because you’re pulling from the database 12,50 then it goes straight to li understood

  • only change in code, where is 10 changes to the number you want

  • Only it would have to be with point né for example 10.50 and not 10,50 correct?

  • where 10 changes to 12.5

  • right and has how to put >= ?

  • in the code is yes, javascript only makes comparison of American numbers, :-)

  • yes can put >=

  • It worked! Only that the field is dynamic the person does not type in it it will only calculate as you select the products if it is in the manual typing straight in the text works more dynamic is not going!

  • There you have to show in the question what is this dynamic there so we can study a solution

  • I’ll change here!

  • I changed the question!

  • @ Leo Caracciolo I made another post can help me? https://answall.com/questions/468396/como-fazer-submit-ser-habiliatado-ap%C3%B3s-o-value-of-text-be-greater-than-x-dynamicam

Show 12 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.