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?
Just to add little more information. One can use multiple not selector like this:
$("div:not(#sale_wrap):not(.sale_class)");
or
$("div:not(#sale_wrap, .sale_class)");
or
$("div").not('#sale_wrap, .sale_class');
The jQuery not() function can do this.
To select all div's except the div with id
of sale_wrap
:
$('div').not('#sale_wrap')
You can then loop over the divs with each()
.
As an example:
#HTML
<p id="1">Some text in paragraph 1</p>
<p id="2">Some text in paragraph 2</p>
<p id="3">Some text in paragraph 3</p>
#JS
# turn background to blue for all 'p' except p with id=2
$('p').not('#2').each(function() {
$(this).css('background-color', 'blue');
});
Check out this example on JsFiddle.
Try using
if($('div').not('#sale_wrap'))
{
t_balance;
}
else
{
var sale = t_balance*((100-window.discount_p)/100);
t_balance = sale;
}
Use not selector
$("div:not(#sale_wrap)")
Alternatively:
$('div[id != "sale_wrap"]')