Comment obtenir le nom de classe dynamiquement en utilisant jQuery
var className = $('#id').attr('class');
Dev
var className = $('#id').attr('class');
var $classOfBtn = 'wpsc-buy-now-button-64';
var id = $(this).attr("id")
var $classOfBtn = wpsc-buy-now-button-64;
$(document).ready(function () {
var $allClasses = $("[name='submit']").attr('class').split(' ');
for(var i=0; i < $allClasses.length; i++)
{
// Check $allClasses[i] here.
}
});
var classArray = $('input').attr('class').split(' ');
// So now you can declare variables
var classbtn1 = classArray[0];
var classbtn2 = classArray[1];
$('.' + $classOfBtn) //note the dot
$('.setvalue').on('click', function() {
var id = $(this).data("id");
var inp = $('#applicantstatus_' + id).val();
$(document).ready(function () {
var $classOfBtn = $('#btn').attr('class').split(' ')[0] + '-64';
alert($classOfBtn );
});