trying to select the first parent of type section
I'm trying to get the nearest Section element with class name lc-local-section-wrap.
I've tried $(this).parent().closest("section") and about everything else, but now I'm stuck!
Html:
- <section class="lc-local-section-wrap">
- <div class="lc-local-button-wrap">
- <input type="text" id="TextCount" value="1" />
- <button type="submit" value="@Model.ToString()" class="btn btn-danger lc-buy-button"><i class="fa fa-cart-plus" aria-hidden="true"></i></button>
- </div>
- <div class="lc-buy-button-done">
- <img src="/Graphic/green-check-symbol.png" />
- </div>
- <div class="lc-buy-button-subscribe-offer">
- <hr />
- <button type="submit" value="@Model.ToString()" class="btn btn-danger lc-buy-subscribe-button"><i class="fa fa-calendar-o" aria-hidden="true"></i><span class="badge">@_localizer.GetString("SubscribeButtonText")</span></button>
- </div>
- <div class="lc-buy-button-create-subscription">
- <hr />
- <h5>
- @_localizer.GetString("SubscribeButtonText")
- </h5>
- <div>
- </div>
- </div>
- </section>
I would like to first get the nearest Section element and use that to select the child element's, something like this:
- $.ShowSubscribeButton = function (thisObj) {
- var section = $.GetSection(thisObj);
- $(section).$(".lc-local-button-wrap").hide();
- $(section).$(".lc-buy-button-done").show();
- $(section).$(".lc-buy-button-subscribe-offer").show();
- $(section).$(".lc-buy-button-create-subscription").hide();
- }
Is this possible?