0

I have a dropdown(Dataspy) , with a single options ,which is coming from the cloud environment, now i want to add an option to my DataSpy dropdown dynamically(since i donot have permissions to access the cloud DB), and below is the image i have attached , i receive during debugging in Chrome , which has values, coming from cloud (in below case value is 100116), how can i create one of that kind using jquery? i donot have any idea . Help me with this.
enter image description here

below is the code where i want to add a new option(WorkRequest) dynamically.

function DropdownChange() {
            //let workrequest = new Option('WorkRequest', '1');
            var x = document.getElementById("ddlServices");
            console.log(x);
            var id = x.options[x.selectedIndex].value;
            console.log(id);
            $('#contenttable').empty();
            $('#contenttable').append('<table id="gridview" class="table table-striped table-bordered dataTable wrap" style="width: 100%"><thead></thead><tbody></tbody></table>');
            document.getElementById("lblHeading").innerText = "<%=Resources.Resource.msg_grid_loading %>"//"Loading...."
            RenderData(id);
        }

3
  • api.jquery.com/append also stackoverflow.com/search?q=%5Bjquery%5D+add+option Commented Apr 26, 2021 at 8:52
  • Hi,thanks freedomn-m, but recently only i have started learning Jquery , so donot know much , can you please give me the solution with the above provided code only please. Commented Apr 26, 2021 at 11:19
  • $('#ddlServices').append($("<option value="100116">All Records</option>"); I recommend you have a good read through learn.jquery.com Commented Apr 26, 2021 at 11:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.