Open vertigoelectric opened 6 years ago
For now, this actually seems to do the job:
$('select').each(function() {
$('option').each(function() {
var option = $(this);
var title = option.attr("title");
if(title)
{
var name = option.text();
option.closest(".selectric-wrapper").find(".selectric-items").find("ul > li").each(function() {
if ($(this).text() == name)
{
$(this).attr("title",title);
}
});
//console.log(name + ": " + title);
}
});
});
My original OPTION elements have attributes that I need to interact with through the selectric dropdowns. In this particular case, I need to the "title" attribute in order to get some text to pop up when hovering over an option.
How can I get selectric to copy the attribute from the original OPTION elements to the selectric LI elements?