$(document).ready(function () { var $allClasses = $("[name='submit']").attr('class').split(' '); for(var i=0; i < $allClasses.length; i++) { // Check $allClasses[i] here. } });