HI i'm facing a problem i want to bind the data to dropdown in document.ready function then i want to set a value to the dropdown to highlite the selected value.
Data is binding but im not able to set a value as a selected value.
here is my code...
$(document).ready(function () {
fillDropdown();
$('#sel').val('005');// I want to set here this way
});
function fillDropdown()
{
var url = "sample.json";
$.getJSON(url, function (data) {
$.each(data, function (index, value) {
// APPEND OR INSERT DATA TO SELECT ELEMENT.
$('#sel').append('');
});
//$('#sel').val('005'); /// I dnt want to set here
});
}
Here is the link for example :
https://plnkr.co/edit/ndDtRL?p=preview
Thanks

Suraj KumarPosted Jun 13, 2019, 5:31 AM
Anilananda ChakraborttyPosted Jun 13, 2019, 2:31 AM
Jignesh KumarPosted Jun 13, 2019, 2:13 AM
Anilananda ChakraborttyPosted Jun 12, 2019, 10:42 PM
Suraj KumarPosted Jun 12, 2019, 1:16 PM
Gajendra JangidPosted Jun 12, 2019, 1:09 PM