I have included given code
<ul class="list-group" data-hook="" id="payment-method-fields">
<li class="list-group-item">
<label>
<input checked="checked" id="method_id_4" type="radio" value="4">
Credit Card
</label>
</li>
<li class="list-group-item">
<label>
<input id="method_id_5" type="radio" value="5">
Test Paypal
<div class="logo">
<img src="/assets/icons/icon-paypal.png">
</div>
</label>
</li>
<li class="list-group-item">
<label>
<input id="method_id_6" type="radio" value="6">
Check
</label>
</li>
<li class="list-group-item">
<label>
<input id="method_id_15" type="radio" value="15">
Ali pay
</label>
</li>
</ul>
Now I want to hide Ali Pay when country is india
var country = $('.currentCountry').attr('value');
if (country=='India') {
}
please guide me how to this i am retrieving this above list dynamically. If country is india then i dont want to show
<li class="list-group-item">
<label>
<input id="method_id_15" type="radio" value="15">
Ali pay
</label>
</li>
In this id changes dynamically so we cannot do this with the help of id Thanks in advance.
您可以将.toggle(boolean)
与:contains(text)
:
$('#payment-method-fields li:contains(Ali pay)').toggle($(".currentCountry").val() !== "India");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.