I am using a chunk of jQuery code that returns a selected option from a group of image icons. It is integrated into the WordPress WYSIWYG Editor.
When I click on the icon this string is sent to the editor:
image="'+ $('.icon-option i.selected').attr('class') +'"
This code returns: fa fa-heart selected
From this string I want to remove the string selected so that it just reads fa fa-heart.
I tried: image="'+ $('.icon-option i.selected').attr('class').split(' ')[0] +'" but it cut the string off at fa
Is this an easy fix that can be added on to my original jQuery String manipulation call?