JSFiddle - React, Tailwind, and code Playground
by Dwi Adi Laksono
HTML
<select id="sel">
</select>
JavaScript
$(function() {
var data = [
{
"id": "1",
"name": "tema 1",
"url":"http://localhost.ku/wordpress/"},
{
"id": "2",
"name": "tema 2",
"url": "http://localhost.ku/temp4/"},
{
"id": "3",
"name" : "tema 3",
"url" : "http://localhost/"
}
];
$.each(data, function(i, option) {
$('#sel').append($('<option/>').attr("value", option.id).text(option.name));
});
/* $('#sel').change(function(){
alert(data.filter(x => x.id === $('#sel').val()).map(x => x.url));}) */
var lo = data.filter(function(item) {
return item.name === 'tema 1';
})
alert(JSON.stringify(lo));
})