Get the value of the background, and select the option of the corresponding select as the default value

/ / Get the value of the background, select the corresponding select option as the default value
$(document).ready(function(){
selectCheckPayStats("v_txn_type","${v_txn_type}");
});
/ / Modify the method of selecting the option default display item
  function selectCheckPayStats(id,value)
   {
    //get the id of the dropdown list
    var select = document.getElementById(id);
    //Get all options of the drop-down list
    var options = select.options;
    //loop to get the corresponding node
    for(var i=0;i<options.length;i++)
    {
     //Get the value of the node and compare it with the value from the background
     if (options[i].value == value)
     {
      //If the current node is consistent with the value from the background, set the current node to the selected state and jump out of the loop
      options[i].selected = true;
      break;
     }
    }
   }

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326896558&siteId=291194637