Shoora
5/3/2019 - 6:16 AM

select form input elements from GET params

select form input elements from GET params

$(function () {
//grab the entire query string
  var query = document.location.search.replace('?', '');
  //extract each field/value pair
  query = query.split('&');
  //run through each pair
  for (var i = 0; i < query.length; i++) {
    //split up the field/value pair into an array
    var field = query[i].split("=");
    //target the field and assign its value
    $("input[name='" + field[0] + "'], select[name='" + field[0] + "']").val(field[1]);
  }
});