i have a string like this :
string_data = "<option value='1'>ahmad</option><option value='2'>mohammad</option><option value='3'>ali</option>"
now i want get the value of value attribute of options and alert it. for this i write this :
$(string_data).contents()
.each(function(){
value = $(this).attr('value');
text = $(this).text();
alert(value);
});
but this code return undefined for all of them .
in Addition string_data is a string that i get it from a php script with Ajax via $.post() jQuery method.
i am using jquery 1.6 .