I am currently working with jQuery and have encountered an issue regarding the reset
functionality for a dropdown list. Specifically, after adding default options in both
Arabic and English, the reset button does not display correctly.
When a value is selected, I want to show a reset button (denoted as "X").
However, if no option is selected, the dropdown should display either "Select port" or "???? ????" without showing the reset button.
Before changing the language to Arabic or English, the reset button appears as expected. Here is the relevant code snippet:
row += "<select id='ddl_Port" + Result.d.P_DISPATCH_DATA[i].DISPATCH_RECID + "' class='form-control chosen-select chosen-rtl' tabindex='1'><option value=''></option>";
var countriesPorts = Result.d.P_PORTS.filter(d => d.COUNTRY_ID == Result.d.P_DISPATCH_DATA[i].PICKUP_COUNTRY_ID);
if (countriesPorts != null) {
if (countriesPorts.length > 0) {
for (var j in countriesPorts) {
row += " <option value='" + countriesPorts[j].PORT_ID + "'>" + countriesPorts[j].PORT_NAME + "</option> ";
}
row += " </select></td>";
}
After switching to Arabic or English, the reset button ("X") does not appear. The code for the dropdown with the default option is as follows:
var defaultOption = MYLang.ReturnLang() == "ar-KW" ? "???? ????" : "select port";
row += "<select id='ddl_Port" + Result.d.P_DISPATCH_DATA[i].DISPATCH_RECID + "' class='form-control chosen-select chosen-rtl' tabindex='1' >" +
"<option value=''>" + defaultOption + "</option>";
var countriesPorts = Result.d.P_PORTS.filter(d => d.COUNTRY_ID == Result.d.P_DISPATCH_DATA[i].PICKUP_COUNTRY_ID);
if (countriesPorts != null && countriesPorts.length > 0) {
for (var j in countriesPorts) {
row += "<option value='" + countriesPorts[j].PORT_ID + "'>" + countriesPorts[j].PORT_NAME + "</option>";
}
Additionally, I would like an image to illustrate the reset button in red on the second row.
![](https://www.csharp.com/forums/uploadfile/6c791c/01192025165210PM/resetbutton.png)