I have a dialog that has values in it. When a li is clicked, I want it to save the value. When the button is clicked, I want the saved values to be placed in the div thats outside of the dialog box ( closing the dialog ). I'm having a problem storing the values and sending them to the previous box ( might have to use AJAX here ).
<!-- this is the dialog box -->
<div class="fontBox">
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
</div>
<div id="Button">Insert Value</div>
<!-- Previous Page -->
<table>
<tr>
<td id="landing">This is where I want the value to go</td>
</tr>
</table>
$('.fontBox ul li').on('click', function () {
$(this).css('background', 'green');
var nValue = $(this).val($(this).text());
localStorage.setItem("nValue", nValue);
if (nValue != null) {
$('#landing').text(nValue);
}
});
Aucun commentaire:
Enregistrer un commentaire