how to access div with period in its class in jquery -
i'm trying access div have period in class i.e clazz.id
, length returned 0
i have made following jsfiddle illustrate issue
here html
<div id="activity-operation" style="" class="edit-form"> <form class="form1"> <div class="server-error" style="display: none;"></div> <fieldset> <div> <input id="c49_id" name="id" type="hidden" class="myclasscustom" value="1"> </div> <div> <input id="c49_subject_id" name="subject_id" type="hidden" class="myclasscustom" value="37"> </div> <div> <input id="c49_activityvalidationtype" name="activityvalidationtype" type="hidden" value=""> </div> <div class="input swfield-name"> <div class="inputtext"> <label for="c49_name" style="float:right;">activity name</label> </div> <div class="inputcontent"> <input id="c49_name" name="name" readonly="readonly" disabled="disabled" type="text"> </div> <div class="input-error" style="display:none;"></div> </div> <div class="input swfield-subject.name"> <div class="inputtext"> <label for="c49_subject_name" style="float:right;">subject</label> </div> <div class="inputcontent"> <input id="c49_subject_name" name="subject_name" readonly="readonly" disabled="disabled" type="text"> </div> <div class="input-error" style="display:none;"></div> </div> <div class="input swfield-activitytype.id"> <div class="inputtext"> <label for="c49_activitytype_id" style="float:right;">select type</label> </div> <div class="inputcontent"> <select id="c49_activitytype_id" name="activitytype_id"> <option value="asig">assignment</option> <option value="clas">class</option> <option value="quiz">quiz</option> </select> </div> <div class="input-error" style="display:none;"></div> </div> <div class="input swfield-term.id"> <div class="inputtext"> <label for="c49_term_id" style="float:right;">select term</label> </div> <div class="inputcontent"> <select id="c49_term_id" name="term_id"> <option value="fa12">fall 2012</option> <option value="fa13">fall 2013</option> <option value="sp12">spring 2012</option> <option value="sp13">spring 2013</option> </select> </div> <div class="input-error" style="display:none;"></div> </div> <div class="input swfield-grading"> <div class="inputtext"> <label for="c49_grading" style="float:right;">grading</label> </div> <div class="inputcontent"> <input id="c49_grading" name="grading" type="text"> </div> <div class="input-error" style="display:none;"></div> </div> <div class="input swfield-class.id error"> <div class="inputtext"> <label for="c49_clazz_id" style="float:right;">select class</label> </div> <div class="inputcontent"> <select id="c49_clazz_id" name="clazz_id"> <option value="">select</option> <option value="22">10</option> <option value="10">9b</option> <option value="11">9c</option> <option value="40">a</option> <option value="41">b</option> <option value="24">c1</option> <option value="25">c2</option> <option value="26">c3</option> <option value="27">c4</option> <option value="87">obj 1</option> <option value="86">rawalpindi board</option> </select> </div> <div class="input-error" style="display:none;">class required</div> </div> <div class="input swfield-section.id"> <div class="inputtext"> <label for="c49_section_id" style="float:right;">select section</label> </div> <div class="inputcontent"> <select id="c49_section_id" name="section_id" readonly="readonly" disabled="disabled"> <option value="select"></option> </select> </div> <div class="input-error" style="display:none;"></div> </div> <div class="input swfield-description"> <div class="inputtext"> <label for="c49_description" style="float:right;">description</label> </div> <div class="inputcontent"> <textarea id="c49_description" name="description" type="text"></textarea> </div> <div class="input-error" style="display:none;"></div> </div> </fieldset> <div class="buttons"> <input class="orangebutton swformsubmitbutton" type="submit" value="submit"> <input class="greybutton swformcancelbutton" type="submit" value="cancel"> </div> </form> </div>
and these selectors i'm trying
alert($("form.form1").find(".swfield-clazz\\\\.id div.inputcontent").length); alert($("form.form1").find(".swfield-clazz\\.id div.inputcontent").length);
i've tried \\
escape period in class not seem working
escaping \\
works.
there no such class swfield-clazz.id
in html.
try rid of periods in class names, though.
Comments
Post a Comment