how to prevent to change selectbox value if i say no to confirm

后端 未结 4 1453
野趣味
野趣味 2021-02-07 00:59

i m using a select box of country, when user select a country then add branch link appears and user add branches under that country, but when user want to change country then al

4条回答
  •  一整个雨季
    2021-02-07 01:49

    The following is working for me (Chrome). Above not. In case of this.defaultValue, it goes to empty other than default selected text/value.

    if(confirm('sure?')){
        //do sth;
    }else{
        this.selectedIndex = 0; // if cancel the confirm window, option remains as unchanged.
    }
    

提交回复
热议问题