我怎么能隐藏街道地址整个div块并只显示公司块?

时间:2015-11-26 00:53:54

标签: javascript jquery css

我无法更改父div标签名称(div class =" pc_flex_form_line_container")

 <div class="pc_flex_form_line_container">
       <div class="pc_flex_form_label_item">Company
       </div>
       <div class="pc_flex_form_required_flag_item"><img src="/corestrengths/s.gif" class="requiredFieldMarker" />
       </div>
       <div class="pc_flex_form_field_item"><input id="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingcompany" type="text" name="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingcompany" class="pc_medium_input_field" /> 
       </div>
   </div>



   <div class="pc_flex_form_line_container">
       <div class="pc_flex_form_label_item">Street Address
       </div>
       <div class="pc_flex_form_required_flag_item"><img src="/corestrengths/s.gif" class="requiredFieldMarker" />
       </div>
       <div class="pc_flex_form_field_item"><input id="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingstreet" type="text" name="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingstreet" class="pc_long_input_field" />
       </div>
   </div>  

1 个答案:

答案 0 :(得分:0)

如果通过街道地址整个div块,则表示具有类pc_flex_form_line_container的第二个元素。你可以这样做:

&#13;
&#13;
$('.pc_flex_form_line_container:eq(1)').hide(); 
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="pc_flex_form_line_container">
       <div class="pc_flex_form_label_item">Company
       </div>
       <div class="pc_flex_form_required_flag_item"><img src="/corestrengths/s.gif" class="requiredFieldMarker" />
       </div>
       <div class="pc_flex_form_field_item"><input id="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingcompany" type="text" name="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingcompany" class="pc_medium_input_field" /> 
       </div>
   </div>



   <div class="pc_flex_form_line_container">
       <div class="pc_flex_form_label_item">Street Address
       </div>
       <div class="pc_flex_form_required_flag_item"><img src="/corestrengths/s.gif" class="requiredFieldMarker" />
       </div>
       <div class="pc_flex_form_field_item"><input id="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingstreet" type="text" name="siteQuickEventRegPage:SiteTemplate:evtRegForm:attendeeInfoForms:2:mailingstreet" class="pc_long_input_field" />
       </div>
   </div>
&#13;
&#13;
&#13;