I want to temporarily save form values in jquery (not in a database) and then echo the value on the same page.
I have a page where there is a button called “add items”, when a user clicks on the “add items” button a form appears in a popup modal. When the save the button is selected on the popup modal values from the popup modal will stored in jquery variables. The values of those variable will then be displayed on a div which I hid at the start.
I don’t know how to show the value in a div, this is what i am doing:
<div id="items">
</div>
$('#items').hide();
$('#popupmodal').click(function(){
$('#savebutton').click(function() {
var price = $('#price').val();
alert(price);
I want to show the price from the pop modal in the div “items”.
You can use the
htmlmethod of jQuery to set an element content :http://api.jquery.com/html/
If you want to escape the html, use
textinstead :http://api.jquery.com/text/
Don’t forget to show your items :