HTML select shows value instead of text

后端 未结 5 920
花落未央
花落未央 2021-01-11 16:53

Is it possible in a html select, to display the value of the option instead of the text?

It\'s gonna be used for displaying a long disription in the dro

5条回答
  •  生来不讨喜
    2021-01-11 16:59

    I think This may help you

    
    

    Try this jquery

    $("#cboSelect").change(function(){    
       $("#cboSelect option:selected").text($("#cboSelect").val());
    });
    

    this will change the text of the selected option with its corresponding value

    Here is the fiddle Fiddle

提交回复
热议问题