I want to cut the price off to all input value in all divs, except only one div sale_wrap
. how do I make an exception with jquery?
<div id="one_wrap"> <input type="checkbox" name="1" value=""> <input type="checkbox" name="1" value=""> </div> <div id="two_wrap"> <input type="checkbox" name="2" value=""> <input type="checkbox" name="2" value=""> </div> <div id="sale_wrap"> <input type="checkbox" name="3" value=""> </div>
jquery:
if($("div").attr("id") != "sale_wrap") { t_balance; } else { var sale = t_balance*((100-window.discount_p)/100); t_balance = sale; }
var noSpace= $('*:not([id])*:not([class])'); // 84 ?
In jQuery, you can use the . length property to check if an element exists. if the element exists, the length property will return the total number of the matched elements. To check if an element which has an id of “div1” exists.
jQuery not() Method: This method returns elements that do not match a defined condition. This method specifies a condition. Elements that do not match the condition are returned, and those that match will be removed. Mostly this method is used to remove one or more than one elements from a group of selected elements.
Use not selector
$("div:not(#sale_wrap)")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With