cfdvlpr wrote:
I have this CSS:
#productSizeTitle {
font-weight:700;
}
#productSizeTitle2 {
font-weight:700;
}
And, down in my HTML I want to display a span with this bold style
twice:
<span id="productSizeTitle">2 x 4</span>
<span id="productSizeTitle2">2 x 4</span>
And, I have some Jquery that updates these two span elements:
var ps = "#productSizeTitle";
var ps2 = "#productSizeTitle2";
$(ps).empty().append(d.attr('productSizeName'));
$(ps2).empty().append(d.attr('productSizeName'));
I know there's a better way to do this. How can I condense this so
that it takes up fewer lines of code?
You can group your selectors, like:
$('#productSizeTitle, #productSizeTitle2')
.empty().append(d.attr('productSizeName'));
-- Klaus