jquery check div dynamic clases code example

Example 1: how to get the class name dynamically using jquery

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

Example 2: how to get the class name dynamically using jquery

<input id="btn" class="wpsc-buy-now-button wpsc-buy-now-button-64" type="image"
    name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
    alt="PayPal - The safer, easier way to pay online" />