I am working on passing a JavaScript variable across all pages in my project. The goal is to calculate the total value from various pages and display it at the end of navigation. Below is an example of my JS code:
<script>
$(document).ready(function() {
$('input[name=q1]').click(function() {
var selectedValue = $(this).val();
if($(this).val() == "A3")
var count=1;
else
var count=0;
});
});
</script>
HTML structure:
<form name="login" action=“page2.html" method="post">
<section class="heading">
<p><strong>Test1</strong></p>
</section>
<p class="pstyle">1st page</p>
<table>
<tr>
<td>
<input type="radio" name="q1" id="q1A1" required value="A1" />
Topic1
</td>
<td style="padding-left: 30px;">
<input type="radio" name="q1" id="q1A2" required value="A2"/>
Topic2
</td>
</tr><br>
<tr style="height: 77px;">
<td>
<input type="radio" name="q1" id="q1A3" required value="A3"/>
Topic3
</td>
<td style="padding-left: 30px;">
<input type="radio" name="q1" id="q1A4" required value="A4"/>
Topic4
</td><br>
<tr>
<td>
<input type="Submit" value=“Next “Page style="font-size: 40px;"/>
</td>
<td style="padding-left: 30px;">
<input type="Submit" value="Cancel" style="font-size: 40px;"/>
</td>
</tr>
</table>
</form>
I'm looking for suggestions on how to pass the "Count" variable to another page using query string instead of local storage. Any advice would be greatly appreciated. Thank you.