I'm attempting to gather the text from all divs' Title Attributes and store them in an array, but I'm having trouble finding the correct selection.
The title is important because it holds the specific string that I require.
Below are three divs with unique titles:
<div class = 'test' title='title1'>Hello</div>
<div class = 'test' title='title2'>goodbye</div>
<div class = 'test' title='title3'>farewell</div>
This is my current jQuery code:
$(document).ready(function() {
$array = $('[title][title!=]').each(function(){
$(this).attr("title").makeArray;})
alert($array)
});
The alert only displays [Object object]
In this example, I am aiming to create an array containing [Title1, Title2, Title3].
Any assistance on achieving this would be greatly appreciated.
********************************UPDATE************************************
Thank you, the initial solution worked perfectly. Your help is truly valued.