How to check whether a select box is empty using JQuery/Javascript

前端 未结 3 1592
感动是毒
感动是毒 2020-12-24 11:59

I have a select box that is being populated dynamically from a database. As of right now the population of this check box is working flawlessly.

I have added functio

3条回答
  •  天命终不由人
    2020-12-24 12:30

    One correct way to get selected value would be

    var selected_value = $('#fruit_name').val()
    

    And then you should do

    if(selected_value) { ... }
    

提交回复
热议问题