In my web application, for the select element I'm loading options from javascript.
By default, it selected the 1st data in the options.
I wanted to remove the default selection or add a placeholder like Select the item likewise.
This is the summarized current code that I wanted to show you.
'<td width="40%">' +
<select onchange="sendInfo(this)" class="form-select ItemId" data-id= '+counter+' name="Item_Id[' +counter +']" id="ItemId[' + counter +']" required="required" ' +
"</select>" +"</td>"
var selectElement = newRow.find("select");
dropdownOptions.forEach(function (option) {
var optionElement = $("<option>").val(option.Value).text(option.Text);
selectElement.append(optionElement);
});
newRow.appendTo("#submissionTable");
selectElement.select2({ width: "100%" });