0
How to check whether or not the % symbol exists along with the value?
The code below is a simplified version. The end result is that the variable taxas
will or will not have the percentage next to the number.
If I have % I will do the calculation according to it. If I have % I will do the simple calculation.
Error: rates.includes is not a Function
$(document).ready(function() {
var formaID = "1";
var formaTaxa = "3.55";
var formaTipo = "%";
if (formaID == "") {
var taxas = $("#formaTaxas").val("0.00");
} else {
var taxas = $("#formaTaxas").val(formaTaxa + formaTipo);
}
if (taxas.includes("%") == true) {
console.log("Tem %");
} else {
console.log("Não tem %");
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
Duplicated and of the same author https://answall.com/questions/398486/usar-o-simblo-de-no-input-maskmoney?noredirect=1#comment782686_398486
– Augusto Vasques