$ (selector). each (function (index,element))
You encounter a property saved by a Drop-down list task at work and the default assignment to the Drop-down list, but the selected property of the list is ' cur ', where you need to select a row record based on the Text property comparison
<Liclass="Item Clearfix"id="cn"style="Display:None"> <Divclass="Label_cont"> <Divid="cn"class="Select_drop edm_select_simulate01"name="Subscription"> <Divclass="D_sselect"> <spanclass=' Showtxt '></span> <Iclass="Triggle_icon"></I> </Div> <Divclass="D_sselect_con"> <Divclass="select_list"> <C: ForEachvar= "S"Items="${11}"> <ahref="javascript:;"class="Options_item"data-val="${S.value}" >${S.text}</a> </C: ForEach> </Div> </Div> <Divclass="Icon_error_tips"> <span>!</span> <P>error Tips </P> </Div> </Div> </Div> </Li>
$ ("#cn"). Find ('. D_sselect_con '). Prev ('. D_sselect '). Find ('. Showtxt '). Text (TASKOBJ.MAILTYPESTR);
$ (' #cn '). Find ('. Options_item '). Each (function() {
if($ (). Text () ==taskobj.mailtypestr) {
$ ( this). addclass (' cur ');
}
);
$ ("#cn"). Find ('. D_sselect_con '). Prev ('. D_sselect '). Find ('. Showtxt '). Text (TASKOBJ.MAILTYPESTR);
This line can only display text content, but the control still does not have a selected value;
so you use each traversal alignment and then assign the property ' cur '