Click here to Skip to main content
15,881,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a unordered list in my page and inside each li I have a label with class name "lbl-colorID" called "RpLblColorID" and I have an input outside the list with class name "sel-Color" called "LblSelColor". Now I want to select the li which has the "RpLblColorID" with the value equal to the "LblSelColor" value. How can I select it in jquery?


 <ul class="thumb-ul">
<asp:DataList runat="server" ID="RptColor" DataSourceID="DSColor" 
RepeatDirection="Horizontal" RepeatLayout="Table" > <ItemTemplate>
                                            <a class="a-pnl-color" href="#">
                                                <li class="thumb-div">

                                                    <div class="col-md-1">
                                                        <asp:label runat="server" ID="RpLblColorID" class="no-display lbl-colorID" Text='<%# DataBinder.Eval(Container.DataItem,"ColorID")%>' />

                                                        <asp:label runat="server" ID="RpLblColorCode"  BackColor='<%# System.Drawing.ColorTranslator.FromHtml(Eval("ColorCode").ToString()) %>'  Width="20px" Height="20px"></asp:label>  
                                                  </div>

                                                    <div class="col-md-2">
                                                        <asp:Label runat="server" ID="RpLblColorName" CssClass="lbl-colorName" Text='<%# DataBinder.Eval(Container.DataItem,"ColorName")%>' ForeColor="Black"></asp:Label>
                                                    </div>
                                                </li>
                                            </a>
                                        </ItemTemplate>
                                    </asp:DataList>
                                </ul>



<input type="hidden" class="sel-color"   runat="server"    id="LblSelColor" name="LblSelColor"    value="0" />


What I have tried:

it doesn't work :

$('ul.thumb-ul li :Label.lbl-colorID').filter(function () { return this.Text == $('.sel-color').val.toString() }).attr('class', 'thumb-div-sel');<pre>
Posted
Updated 15-Apr-17 19:39pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900