Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
990 views
in Technique[技术] by (71.8m points)

javascript - How to get parent element in jQuery when child element is known?

I'm using jQuery Mobile which creates a lot of the DOM for you. I need to remove() radio buttons, but based on how the HTML is constructed in jQuery Mobile, I do not have an id for the parent div. I can easily grab both the input and labels, but need to also get rid of the our div to completely removed the entry styling from the list of radio buttons.

<div class="ui-radio">
  <input type="radio" value="ahBkMj" id="ahBkMj" name="spam" data-theme="c">
  <label for="ahBkMj" class="ui-btn ui-btn-icon-left ui-btn-up-c">
    <span class="ui-btn-inner">
      <span class="ui-btn-text">Foo</span>
      <span class="ui-icon ui-icon-ui-icon-radio-off ui-icon-radio-off"></span>
    </span>
  </label>
</div>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Will jQuery's .parent() do ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...