Scenario 1: Display data to variables
Steps:
1. Edit your Question. Click Question Editor and click Toggle Source mode
2. Create and Add html code in your Question List:
Note: Variables VehicleMake and OrigDate sample variables that we will be using to this scenario.
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var url_string = window.location.href; var url = new URL(url_string); var VehicleMake = url.searchParams.get("VehicleMake"); var OrigDate = url.searchParams.get("OrigDate"); $('.VehicleMake').html("<b>" + VehicleMake + "</b>"); $('.OrigDate').html("<b>" + OrigDate + "</b>"); }); </script>
Output:
Scenario 2: Display data using multiple short text with condition.
Steps:
1. Edit your Question and Click Preview Question
2. Right click the textbox, click INSPECT and Copy all values of your textbox e.g. name = '263929X9X126SQ02' and id ='answer263929X9X126SQ02' (will be used in step 3)
3. Go back to your question, click Question Editor then click Toggle Source Mode
4. Create and Add html code in your Question List:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var url_string = window.location.href; var url_string = window.location.href; var url = new URL(url_string); var answer263929X9X126SQ02 = url.searchParams.get("263929X9X126SQ02"); var answer263929X9X126SQ03 = url.searchParams.get("263929X9X126SQ03"); var answer263929X9X126SQ04 = url.searchParams.get("263929X9X126SQ04"); var answer263929X9X126SQ05 = url.searchParams.get("263929X9X126SQ05"); $('#answer263929X9X126SQ02').val(answer263929X9X126SQ02); $('#answer263929X9X126SQ03').val(answer263929X9X126SQ03); $('#answer263929X9X126SQ04').val(answer263929X9X126SQ04); $('#answer263929X9X126SQ05').val(answer263929X9X126SQ05); }); </script>
Output: