I am making the simple site but stuck on the very simple concept that is to take the values from class attribute value from button having multiple classes.When I am trying to use attr(), It shows string having multiple classes.My problem is how to access it???, The code of this is given below.
HTML CODE
<button id="view" class="cc btn btn-primary">View</button>
JS CODE
<script type="text/javascript">
$('button').click(
function()
{
$id=$(this).attr('id');
$class=$(this).attr('class');////////cc btn btn-primary but i want only `cc`
}
)
</script>