I have a list of elements that have multiple classes, for example:
You can also try:
$(".etape").click(function () { var theClass = $(this).attr("class").match(/btn[\w-]*\b/); console.log(theClass); });
Uses match instead of grep...