Some of the code below:
Copy Code code as follows:
<select name= "company_id" id= "company_id" >
<option selected= "selected" value= "B" >BBB</option>
<option value= "A" >AAA</option>
<option value= "C" >CCC</option>
</select>
problem: JS How to change the Select label in the BBB to XXX, while the valued of the BBB in the value of the change to F?
The positive solution code is as follows:
Copy Code code as follows:
Function Cheng ()
{
var Mylist=document.getelementbyid ("company_id");
mylist.options[0].text= "XXX";
}
<input type= "button" onclick= "Cheng ()" value= "change bbb to xxx"/>
Copy Code code as follows:
Modify Value= "Paravalue" in the Select option with the text "Paratext"
function Jsupdateitemtoselect (objselect,objitemtext,objitemvalue)
{
To determine whether there is
if (Jsselectisexititem (Objselect,objitemvalue))
{
for (Var i=0;i<objselect.options.length;i++)
{
if (Objselect.options[i].value = = Objitemvalue)
{
Objselect.options[i].text = Objitemtext;
Break
}
}
Alert ("Successful modification");
}
Else
{
Alert ("The item does not exist in the select");
}
}