How to add to the number in input 'e (input field) a certain number or percentage at the expense of the input button? The main thing is that it is displayed in h4 or p .

Closed due to the fact that the essence of the question is unclear by the participants user194374, AK , Kromster , Vadim Ovchinnikov , ermak0ff Jan 9 '17 at 12:42 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

     var inputValue = document.getElementById('inputId').value; // search input with id "inputId" inputValue = parseInt(inputValue); // parse string value to integer inputValue += 4; // or another number document.getElementsByTagName('h4')[0].innerHTML = inputValue; // search h4 tag and writing your value 

    Sorry for the comments in English, trying to learn English) It was pure js code, but using jQuery:

     var inputValue = parseInt($('#inputId').prop('value')) + 4; $('h4:eq(0)').html(inputValue); 
    • I trying to learn English - search for input - Igor
    • I am trying to learn English - it is commendable, but still it is stackoverflow in Russian , so it would be desirable .... - Alexey Shimansky