0
I don’t know how to research and in case there might be the same kind of difficulty around here, I’m sorry.
I’m having a hard time, I want to take the value that is presented after Ubmit and put this value with id="result" in an input to postriorly send in a form. Only that the value it presents is coming as text and I want to take this text for an input.
Example: TEXT: R$ 0,00 Pick this result and play in input.
What I’ve done and can imagine what it can be:
JS:
$("#resultado").text("R$ " + (bandeirada + distancia * bandeira + (duracao / 3) * tempo_parado).toFixed(2));
I don’t know if the value . text can be, but it has some other kind of value?
HTML:
<td class="text-primary" name="resultado" id="resultado"></td>
I have a modal of bootstrap on the same page and in case it was input to input I know how to do. Now Text to input not to knowing :(
EDIT: I was able to display the value after Ubmit by changing . text to . val Now I want to take the value after Submit to the modal input. Follow picture: https://i.ibb.co/dcxCkrR/psc.png
EDIT2: Now I’m at another impasse, as per image https://i.ibb.co/Nxfxpyz/input.png
The values I take and pass to another input are values after Submit.
Javascript after Ubmit to get the values and onclick="setValue":
function setValue () {
var nome = document.getElementById("end").value;
document.getElementById("destino_form").value = nome;
};
And when I want to take a 'result' value from one input and move on to another after I’ve given Submit?
Thank you!
I don’t quite understand, you want to get the text from inside this
td id="resultado"
, that’s it?– andre_luiss
https://i.ibb.co/dcxCkrR/psc.png - Here is an image of the value shown after Ubmit and I want q in the modal.
– JeanAlves
So you can give one
.val()
in the input to read, and a.val(valor)
to assign, but you commented q already know how to do this, if to get a text is the same way,.html()
reads the html q has inside the selector,.html( valor )
assigning– andre_luiss
I made a new edition as edit2
– JeanAlves
You made the function in jquery inves javascript now, but the procedure is the same, and its function seems to be ok, you take with
.value
and a set with.value = valor
, what would be your doubt? if this function is not working, maybe it is in the referencing of the elements in the DOM or how you are calling it– andre_luiss
I got it with the same function presented above! Thanks Luis! I was really missing on a reference of a name. Thanks!
– JeanAlves
Show, I’m glad you decided!!
– andre_luiss
How are you using Bootstrap would do with the
$('iddomodal').on('show.bs.modal', function (event) {...}
of the Bootstrap modal itself. But if you’ve decided to let it go.– Gnomo Escalate