Just chain the CSS classes together, separated by periods:
$('.button.check').html("sample data");
You will also see better performance in some browsers, by specifying the tag name as well:
$('div.button.check').html("sample data");
Update: After reading Brian's answer, I re-read the original question I realized you might be under the impression you need to use both to reference the div
. If you had:
<div class="button cancel">Cancel</div>
<div class="button check">Check</div>
Then chaining selectors (i.e. .button.cancel
) would make sense. However, if it was the only div
on the page or you wanted all the divs
with button
class, you don't need both classes:
<div class="button check">Check</div>
This would select it fine:
$('div.check').html("sample data");