get class from string jquery code example Example: how to get class name in jquery var className = $('#sidebar').attr('class');