how to get the class name dynamically using jquery

Solutions on MaxInterview for how to get the class name dynamically using jquery by the best coders in the world

showing results for - "how to get the class name dynamically using jquery"
Aymen
08 Sep 2019
1$(document).ready(function () {
2    var $allClasses = $("[name='submit']").attr('class').split(' ');
3    for(var i=0; i < $allClasses.length; i++)
4    {
5        // Check $allClasses[i] here.
6    }
7});
8
Philipp
09 Jul 2020
1 $('.setvalue').on('click', function() {
2       var id = $(this).data("id");
3       var inp =  $('#applicantstatus_' + id).val();
Brittany
11 Nov 2019
1<input id="btn" class="wpsc-buy-now-button wpsc-buy-now-button-64" type="image"
2    name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
3    alt="PayPal - The safer, easier way to pay online" />
4
Annalisa
26 Oct 2017
1var id = $(this).attr("id")
Inès
06 Mar 2018
1$('.' + $classOfBtn) //note the dot
2
Sofia
16 Jun 2020
1var classArray = $('input').attr('class').split(' ');
2// So now you can declare variables
3var classbtn1 = classArray[0];
4var classbtn2 = classArray[1];
5
Mélissa
02 Feb 2020
1var $classOfBtn = wpsc-buy-now-button-64;
2
Maria José
04 Nov 2016
1var $classOfBtn = 'wpsc-buy-now-button-64';
2
Nahel
21 Mar 2017
1var className = $('#id').attr('class');
2
Elena
21 Jan 2017
1$(document).ready(function () {
2    var $classOfBtn = $('#btn').attr('class').split(' ')[0] + '-64';
3    alert($classOfBtn );
4});
5
similar questions