1

I want to hide child div with id="checkbox-No recent experience_txh6181p" using css.

  <div class="row">
              <div class="grid-layout-col">
                <div class="layout-col col-sm-12 col-xs-12">
                  <div id="formElement8" class="elq-field-style form-element-layout row">
                    <div style="text-align:left;" class="col-sm-12 col-xs-12"><label class="elq-label "
                        for="fe1729">skills</label></div>
                    <div class="col-sm-12 col-xs-12">
                      <div class="row">
                        <div class="col-xs-12">
                          <div class="field-control-wrapper" id="fe1729">
                            <div class="list-order one-column"><input type="checkbox"
                                id="checkbox-Used Java for school projects_hvba7ekg"
                                value="Used Java for school projects" name="checkboxes"><label
            

                class="checkbox-aligned elq-item-label"
                            for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school
                            projects</label><br></div>
                        <div class="list-order one-column"><input type="checkbox"
                            id="checkbox-0-1 years of professional experience_uwv0lzq"
                            value="0-1 years of professional experience" name="checkboxes"><label
                            class="checkbox-aligned elq-item-label"
                            for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional
                            experience</label><br></div>
                        <div class="list-order one-column"><input type="checkbox"
                            id="checkbox-1-3 years of professional experience_jp55zebf"
                            value="1-3 years of professional experience" name="checkboxes"><label
                            class="checkbox-aligned elq-item-label"
                            for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional
                            experience</label><br></div>
                        <div class="list-order one-column"><input type="checkbox"
                            id="checkbox-4+ years of professional experience_uey2b9qdk"
                            value="4+ years of professional experience" name="checkboxes"><label
                            class="checkbox-aligned elq-item-label"
                            for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional
                            experience</label><br></div>
                        <div class="list-order one-column"><input type="checkbox"
                            id="checkbox-No recent experience_txh6181p" value="No recent experience"
                            name="checkboxes"><label class="checkbox-aligned elq-item-label"
                            for="checkbox-No recent experience_txh6181p">No recent experience</label><br></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

I want to hide the option "checkbox-No recent experience_txh6181p" using id or using the nth div CSS. How can I do this?

sk_nath
  • 13
  • 4
  • I cannot remove space in the id. is there any other to hide the last checkbox? – sk_nath Sep 14 '20 at 08:38
  • `id's` value must not contain **whitespace (spaces, tabs etc.).** Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. more info [visit](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id) – Rayees AC Sep 14 '20 at 08:40

2 Answers2

0

Your ID contains space it is not valid in html.

id's value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. more info visit this

#checkbox-Norecentexperience_txh6181p{display:none;}// remove checkbox
#checkbox-Norecentexperience_txh6181p+label{display:none;} // to remove label

#checkbox-Norecentexperience_txh6181p{display:none;}
#checkbox-Norecentexperience_txh6181p+label{display:none;}
<div class="row">
  <div class="grid-layout-col">
    <div class="layout-col col-sm-12 col-xs-12">
      <div id="formElement8" class="elq-field-style form-element-layout row">
        <div style="text-align: left;" class="col-sm-12 col-xs-12"><label class="elq-label" for="fe1729">skills</label></div>
        <div class="col-sm-12 col-xs-12">
          <div class="row">
            <div class="col-xs-12">
              <div class="field-control-wrapper" id="fe1729">
                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-Used Java for school projects_hvba7ekg" value="Used Java for school projects" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school projects</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-0-1 years of professional experience_uwv0lzq" value="0-1 years of professional experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional experience</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-1-3 years of professional experience_jp55zebf" value="1-3 years of professional experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional experience</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-4+ years of professional experience_uey2b9qdk" value="4+ years of professional experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional experience</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-Norecentexperience_txh6181p" value="No recent experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-Norecent experience_txh6181p">No recent experience</label><br />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

OR

You can you last-child in css to hide.That is,

.list-order.one-column:last-child{display:none;}

.list-order.one-column:last-child{display:none;}
<div class="row">
  <div class="grid-layout-col">
    <div class="layout-col col-sm-12 col-xs-12">
      <div id="formElement8" class="elq-field-style form-element-layout row">
        <div style="text-align: left;" class="col-sm-12 col-xs-12"><label class="elq-label" for="fe1729">skills</label></div>
        <div class="col-sm-12 col-xs-12">
          <div class="row">
            <div class="col-xs-12">
              <div class="field-control-wrapper" id="fe1729">
                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-Used Java for school projects_hvba7ekg" value="Used Java for school projects" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-Used Java for school projects_hvba7ekg">Used Java for school projects</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-0-1 years of professional experience_uwv0lzq" value="0-1 years of professional experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-0-1 years of professional experience_uwv0lzq">0-1 years of professional experience</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-1-3 years of professional experience_jp55zebf" value="1-3 years of professional experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-1-3 years of professional experience_jp55zebf">1-3 years of professional experience</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-4+ years of professional experience_uey2b9qdk" value="4+ years of professional experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-4+ years of professional experience_uey2b9qdk">4+ years of professional experience</label><br />
                </div>

                <div class="list-order one-column">
                  <input type="checkbox" id="checkbox-Norecentexperience_txh6181p" value="No recent experience" name="checkboxes" />
                  <label class="checkbox-aligned elq-item-label" for="checkbox-Norecent experience_txh6181p">No recent experience</label><br />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
Rayees AC
  • 4,426
  • 3
  • 8
  • 31
  • Are you want like this @sk_nath ? – Rayees AC Sep 14 '20 at 08:24
  • @Ryees AC I cannot remove the space in the id, is there any other way to hide the checkbox – sk_nath Sep 14 '20 at 08:33
  • `id's` value must not contain **whitespace (spaces, tabs etc.).** Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. more info [visit](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id) – Rayees AC Sep 14 '20 at 08:36
  • Then, try the second demo. `.list-order.one-column:last-child{display:none;}` – Rayees AC Sep 14 '20 at 08:39
  • Thank You! That works, But my form has many fields with "list-order one-column". this `.list-order.one-column:last-child{display:none;}` will hide last checkbox in all the fields right? – sk_nath Sep 14 '20 at 08:49
  • Are you want to hide the div is in last ? – Rayees AC Sep 14 '20 at 08:51
  • you can add any id or class in form and add to it `#formid .list-order.one-column:last-child{display:none;}` will hide specific form contains the last div ok :) – Rayees AC Sep 14 '20 at 08:52
0

Either use #experience_txh6181p{display:none;} or #experience_txh6181p{height:0px; overflow:hidden}