-1
I’d like the numbers on the imported file to show up in the cell phone box, not below, like this one showing up. If anyone can help me with that, I’d appreciate it.
That and the test:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>TEST</title>
</head>
<body>
<input type="file" id="inputCSV" onchange="pegaCSV(this)">
<div id="CSVsaida"></div>
<div class="line">
<label>
<span class="red">*</span>
Celulares
</label>
<textarea name="msgSmsMobile" cols="35" rows="5" class="dest formulario"></textarea>
</div>
</body>
<script>
var leitorDeCSV = new FileReader()
window.onload = function init() {
leitorDeCSV.onload = leCSV;
}
function pegaCSV(inputFile) {
var file = inputFile.files[0];
leitorDeCSV.readAsText(file);
}
function leCSV(evt) {
var fileArr = evt.target.result.split('\n');
var strDiv = '<table>';
for (var i = 0; i < fileArr.length; i++) {
strDiv += '<tr>';
var fileLine = fileArr[i].split(',');
for (var j = 0; j < fileLine.length; j++) {
strDiv += '<td>' + fileLine[j].trim() + '</td>';
}
strDiv += '</tr>';
}
strDiv += '</table>';
var CSVsaida = document.getElementById('CSVsaida');
CSVsaida.innerHTML = strDiv;
}
</script>
</html>
Breno, when you say in the box, you mean inside your textarea name msgSmsMobile?
– Daniel Mendes
Even Daniel, could you help me.
– breno0112
Breno, I can, but this html formatting you created, does it have to exist? Because by default, the textarea is plain text, if you tag, it will not be rendered, it will simply appear the same.
– Daniel Mendes
Can’t be any other kind without problem the important and the page stay functional...
– breno0112