I want to create an array with would hold all option element values and html text. And in a result I would like something like this:
console.log( myArray );
output:
[ "htmlText" : '0', "htmlText2" : '1', ... ]
if this is possible, how can I access them and get their keys?
or at least 2dim array
How Can I do that?
this is what I have now:
function optionValues( selectEl )
{
var values = [];
if ( selectEl.length )
{
$(selectEl).find('option').each( function(){
values.push( $(this).val() );
});
return values;
}
else
return false;
}
function optionHtmls( selectEl )
{
var html = [];
if ( selectEl.length )
{
$(selectEl).find('option').each( function(){
html.push( $(this).html() );
});
return html;
}
else
return false;
}