#### Get Class List For An Element With JavaScript

Here we consider how to Get Class List For An Element With JavaScript. Suppose we have a Div with multiple Classes as shown below. The above Div contains three Classes and its ID is DivID. For getting the list of all classes into an array, we can follow below shown code.

var list = document.getElementById('DivID'). className.split(/\s+/);

For getting a particular Class from the above list, we can follow below code.

var list = document.getElementById('DivID'). className.split(/\s+/);
for (var i = 0; i < list.length; i++) {

if (list[i] === 'Class Name') {
// You Code Here....
}
}

That's only, by using above code we can Get The Class List For Element With JavaScript.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6614563,"math_prob":0.79263204,"size":718,"snap":"2023-14-2023-23","text_gpt3_token_len":166,"char_repetition_ratio":0.11764706,"word_repetition_ratio":0.08547009,"special_character_ratio":0.2632312,"punctuation_ratio":0.16551724,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9532871,"pos_list":[0,1,2],"im_url_duplicate_count":[null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-26T06:35:54Z\",\"WARC-Record-ID\":\"<urn:uuid:5a3b6fc5-9217-485c-b51f-76232d8ccb1f>\",\"Content-Length\":\"18870\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:608918ad-77f0-443f-8939-beae0865ec01>\",\"WARC-Concurrent-To\":\"<urn:uuid:96d0bf66-e424-4798-b4b4-cdcf2d0a4ddf>\",\"WARC-IP-Address\":\"107.161.186.242\",\"WARC-Target-URI\":\"https://technomark.in/Get-Class-List-For-Element-With-JQuery.aspx\",\"WARC-Payload-Digest\":\"sha1:C5Z57DAXTGQBJN36KXMT6MJS3BWPGGLT\",\"WARC-Block-Digest\":\"sha1:Y6JWMTFQI5S3LO46MCBAOLKUHL654XC6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296945433.92_warc_CC-MAIN-20230326044821-20230326074821-00683.warc.gz\"}"}