KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How to get the value of option select box in jQuery if I have the code like this, <select id='media' name='media'> <option value='1'>media1</option> <option value='2'>media2</option> <option value='3'>media3</option> </select> When I code for on change event, $(document).ready(function() { $("#media").change(function() { var id=$(this).val(); var dataString = 'id='+ id; alert(id); return false; }); }); It gives me media1 , media2 , media3 instead of 1, 2, 3 How to get the value 1, 2, 3?
Tags (comma-separated)
Save Edits
Cancel