javascript - Getting child input from div jquery -
i have repeater has usercontrol inside shows me 3 security questions this:
<asp:repeater runat="server" id="rptsecurityquestions"> <itemtemplate> <it:textboxcontrol_v2 id="txtquestion" runat="server" showlabel="true" minlength="1" maxlength="64" label='<%# databinder.eval (container.dataitem, "question") %>' regexexpression="" textmode="singleline" cssclass="field field-padding-r metro col-centered securityquestions" isrequired="true" /> </itemtemplate> </asp:repeater>
and displays 3 times:
<div class="securityquestions"> <span>question 1</span> <input></input> </div>
all want inputs child of div.
i tried didn't work out.
$(this).children('securityquestions').addclass('hover_triangle');
it simple typo error
specify class prefixing .
$(this).find('.securityquestionsinput[type="text"]').addclass('hover_triangle');
if want apply class parent of input element use below
$(this).find('.securityquestionsinput[type="text"]').parent().addclass('hover_triangle');
demo:
$('#test').find('.test input[type="text"]').addclass('hover_triangle');
.hover_triangle{background-color:red}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="test"> <div class="test"><input type="text"></div> <div class="test">2</div> <div class="test">3</div> <div class="test">4</div> <div class="test">5</div> <div class="test">6</div> </div>
Comments
Post a Comment