Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is how you would do it by referencing a div ID</p> <pre><code>$(document).ready( function () { alert($('#yourDivID').attr('class').split(' ')[1]); }); </code></pre> <p>The split function will allow you to split a string with the specified delimiter. This will return an array of your separated values. In this case will return an array of classnames.</p> <p>Reference for split an other string methods <a href="http://www.javascriptkit.com/javatutors/string4.shtml" rel="nofollow noreferrer">http://www.javascriptkit.com/javatutors/string4.shtml</a></p> <p>You should look into the following jQuery Selectors and Functions for accessing classes</p> <p><strong>Selectors</strong></p> <p><a href="http://api.jquery.com/class-selector/" rel="nofollow noreferrer">http://api.jquery.com/class-selector/</a> select a dom element with the specified class</p> <p><a href="http://api.jquery.com/has-selector/" rel="nofollow noreferrer">http://api.jquery.com/has-selector/</a> select a dom element that has the specified selector</p> <p><strong>Functions</strong> </p> <p><a href="http://api.jquery.com/addClass/" rel="nofollow noreferrer">http://api.jquery.com/addClass/</a> method to add a class to a jQuery object</p> <p><a href="http://api.jquery.com/removeClass/" rel="nofollow noreferrer">http://api.jquery.com/removeClass/</a> method to remove a class to a jQuery object</p> <p><a href="http://api.jquery.com/toggleClass/" rel="nofollow noreferrer">http://api.jquery.com/toggleClass/</a> method to toggle a class to a jQuery object</p> <p><a href="http://api.jquery.com/hasClass/" rel="nofollow noreferrer">http://api.jquery.com/hasClass/</a> method to check if a jQuery object has the specified class</p> <p><a href="http://api.jquery.com/attr/" rel="nofollow noreferrer">http://api.jquery.com/attr/</a> method to retreive attributes of a jQuery object</p> <p>Edited: <a href="https://web.archive.org/web/20140903135323/http://labs.impulsestudios.ca/downloads/impulse_studios-jquery_cheat_sheet-1.0.pdf" rel="nofollow noreferrer">Nice cheat sheet</a></p> <p><a href="https://i.stack.imgur.com/oQ557.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oQ557.jpg" alt="enter image description here"></a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload