1
Good afternoon, I need to return a result in an input. how do?
HTML
<div class="form-group">
<input class="form-control input-lg" type="text" name="cc-number" id="cc-number">
</div>
<div class="form-group">
<input class="form-control input-lg" name="cc-flag" id="cc-flag" type="text">
</div>
I’ll type in the input cc-number and give me the result on cc-flag
JAVASCRIPT
var input = document.querySelector('input.cc-number')
var result = document.querySelector('input.cc-flag')
input.addEventListener('change', onInputChange)
input.addEventListener('input', onInputChange)
function onInputChange (e) {
var cards = CardType.cardType(e.target.value)
result.innerHTML = JSON.stringify(cards)
}
OBS: It works properly by returning to a DIV. But I need it back to an INPUT
You want to put the value of a
input
within anotherinput
?– Mauro Roberto
That’s right... the first input does a search in a file . js and returns a value. need that this value be returned inside the input
– Betinho Silva