Created
December 1, 2016 19:05
-
-
Save leepettijohn/dad36c30c23be05abfed17dee37ab723 to your computer and use it in GitHub Desktop.
Find class that starts with string and return the rest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("div[class*='fa-']").each(function(){ | |
var check = "fa-"; | |
// Get array of class names | |
var cls = $(this).attr('class').split(' '); | |
for (var i = 0; i < cls.length; i++) { | |
// Iterate over the class and log it if it matches | |
if (cls[i].indexOf(check) > -1) { | |
console.log(cls[i].slice(check.length, cls[i].length)); | |
return cls[i].slice(check.length, cls[i].length); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment