Val Of Select = Null, If Values Is Disabled February 22, 2024 Post a Comment I have Select and all values is disabled, how can I set the value to this Select? 1Solution 1: Try This ==>alert($('#testselect option[disabled]:selected').val());Copy<scriptsrc="https://code.jquery.com/jquery-2.2.4.min.js"></script><selectid="testselect"><optiondisabled>1</option><optiondisabled>2</option><optiondisabledselected>3</option></select>CopySolution 2: You have to be specific about value of which element to return.alert($("#testselect option:selected").val());Copy<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><selectid="testselect"><optiondisabled>1</option><optiondisabled>2</option><optiondisabledselected>3</option></select>Copy Share Post a Comment for "Val Of Select = Null, If Values Is Disabled"
Post a Comment for "Val Of Select = Null, If Values Is Disabled"