How can I get a value from the select box in JQuery : I want to get the value of the selected option from the selected box by using JQuery but it ain't working.

I have tried a million ways to do it. Trying to get its text instead, tried to get the value from multiple ways. To know what is coming in my jquery variable.

```
<!-- HTML Code -->
<select class="form-control" id="cateogry" name="category">
     <option value="0" disabled selected>Choose Project Category</option>
     <option value="active">Active Project</option>
     <option value="drafted">Drafted Project</option>
</select>

<!-- JQuery Script -->
<script>
    $(document).ready(function () {
         //First thing i tried
         var category = $('#category').val();
         alert(Category);

         //Second thing i tried
         var category = $('#category').filter(":selected").val();
         alert(Category);

         //Third thing i tried
         var category = $('#category').find(":selected").text();
         alert(Category);

         //Fourth thing i tried
         var category = $('#category').find(":selected").val();
         alert(Category);

         //Fourth thing i tried
         var category = document.getElementById('category').value;
         alert(Category);

         //Now directly taking the value of selected option by id
         alert($("#category :selected").attr('value'));

         //These are the code snippets I tried at different times so don't 
         think that I did this all a time which can obviously throw some 
         exception.
    });
</script>
```

All the options I have given above and tried all of them one by one and put an alert to see what is it getting and the alert said undefined. What can I do?