jQuery Question

How add value to input

I have a short question. I need add value in all input on page, but it value not save. This is my code:


How I can input value and save result?

Answer Source

Like this? I don't clearly about "How I can input value and save result?". I hope it can help you :)

var value = $('.formInput').val();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input class="formInput" type="text" />
<input type="submit" class="getValue" value="Get Value" />