html - How to trigger the Span element to populate with the value entered in Input field (Javascript) -
i'm creating bookmarklet webpage , have come across span id="totalamount" element (summary table) populates after value manually entered input field (id="amount") clicking , typing value. can enter value using bookmarklet span id="totalamount" element not being populated. missing?
this html
<input id="amount" class="with-prefix sum-amount" type="tel" value="" name="amount" data-val-required="please enter amount" data-val-regex-pattern="^\d*\.?\d{0,2}$" data-val-regex="please enter amount" data-val-reasonableincome="" data-val-number="the field amount? must number." data-val="true" aria-describedby="amounttooltip"/> <div class="summary-table clearfix"> <div class="summary-table-item"> <span class="text">total amount</span> <span class="curr-sign">£</span> <span id="totalamount" class="value"/> </div>
when entering value input field manually, span element gets same value populated , code changes to:
<span id="totalamount" class="value">25000.00</span>
but when use following bookmarklet, although input field entered value, "totalamount" span isn't getting populated
javascript: var newpage = { formfill: function() { document.queryselectorall("#amount")[0].value = '25000'; } }; newpage.formfill()
note: i'm unable modify html due permissions
much appreciated
span
not input
element, has innerhtml
, not value
document.getelementbyid( "amount" ).onchange = function(){ document.getelementbyid("totalamount").innerhtml = this.value; }
Comments
Post a Comment