JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" name="Pacote" value="primeira opcao" onclick="pega(event)">
<input type="text" id="number1" value ="1"/>
<input type="checkbox" name="Pacote" value="segunda opcao" onclick="pega(event)">
<input type="text" id="number2" value="10" />
<div id="total"></div>
JavaScript
var opcoes = document.querySelectorAll('input[type="checkbox"]');
var inputs = document.querySelectorAll('input[type="text"]');
function lerValores(els) {
return [].map.call(els, function (el) {
return el.checked;
});
}
function pega(e) {
var total = 0;
lerValores(opcoes).forEach(function (checked, i) {
if (checked) total += parseInt(inputs[i].value, 10);;
});
document.getElementById("total").innerHTML = total;
}