Jquery get value of dropdown selected
var conceptName = $('#aioConceptName').find(":selected").text();
Jquery get value of dropdown selected
var conceptName = $('#aioConceptName').find(":selected").text();
get selected value of dropdown in javascript
<body>
<select id="list" style="padding: 10px;" onchange="getSelectValue();">
<option value="js">JavaScript</option>
<option value="php">PHP</option>
<option value="c#">Csharp</option>
<option value="java">Java</option>
<option value="node">Node.js</option>
</select>
<script>
function getSelectValue()
{
var selectedValue = document.getElementById("list").value;
alert(selectedValue);
}
getSelectValue();
</script>
</body>
How check the selected value in dropdown?
How do you handle Select type of dropdown?
- If it is <select> we would have to use Select class from Selenium.
- Methods to select from dropdown:
Select s = new Select(element);
- s.selectByVisibleText
- s.selectByValue
- s.selectByIndex
--> How do we verify which option is selected in a dropdown?
- If we want to get the currently selected option,
we use getFirstSelectedOption() method.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us