I’m working with this code snippet:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
// <![CDATA[
$(document).ready(function() {
// Parse your query parameters here, and assign them to a variable named `queryParams`
var option = queryParams.type;
$("#GCValue").val(option);
});
// ]]>
</script>
I don’t have a lot of latitude with how I can affect the page, this is in the <body>
section of the page, since I don’t have access to the <head>
tag.
I have this form:
<select id=GCValue>
<option val="10">10</option>
<option val="25">25</option>
<option val="50">50</option>
<option val="100">100</option>
<option val="250">250</option>
</select>
and I would like to use the URL of the page to select one of these five options (currently default is 10). I think it’s supposed to be either https://www.mywebsite.com/gift-card/?type=2
or https://www.mywebsite.com/gift-card/?GCValue=2
but neither work. I’m pretty new to JS and JQuery, so I know I have to be doing something wrong. Any help appreciated.