This article mainly introduces how to automatically search for the select drop-down menu in js and select the menu (Sample Code) for your reference.
The Code is as follows:
Function find_select (name)
{
Var select = document. getElementsByName (name );
Var find_str = document. getElementById ('to _ find_str '). value;
If (select)
{
Select = select [0];
Var child = select. childNodes;
Var can = false, text = '', len = child. length, is_end = true;
For (var I = 0; I {
If (can)
{
Text = child [I]. text;
If (text &&
Text. indexOf (find_str )! =-1)
{
// Console. log (text );
Child [I]. selected = true;
Var v = child [I]. value;
Select. value = v;
Select. onchange (v );
Is_end = false;
Break;
}
}
If (child [I]. selected)
Can = true;
}
If (is_end)
Alert ('no matching content ');
}
}
The Code is as follows:
Select Foreach ($ ActivityTypes as $ Row ){Echo''. $ Row ['name'].'';}?>
--