Get Category ID from <select> menu?

Status
Not open for further replies.

Exel

Active Member
2,074
2008
543
100
ZbIgD.png
 
4 comments
You can do this with jQuery something like this :
PHP:
<script type="text/javascript">
$(function () ) {
       $('#category_id').change(function(){
       var id = $(this).find(':selected')[0].id;
       $('#something').val(id);

       alert(id); // this is just for testing remove this :|
});
</script>

<input type="hidden" name="category_id_s" value="cars" id="something" />
etc..
 
Not sure why you would want to get the selected value to another html element.
You can get the same thing by adding name="category_id" attribute to the select tag. Value of category_id when submitted would be equal to the selected item's value
 
I have problem maybe like this...
you can see this thread
Code:
http://www.wjunction.com/92-development-area/159368-print-selected-value-list-menu-php.html
or here is full code
Code:
http://pastebin.com/5U5Xedp8
maybe this be helpful
 
Not sure why you would want to get the selected value to another html element.
You can get the same thing by adding name="category_id" attribute to the select tag. Value of category_id when submitted would be equal to the selected item's value

That worked, thanks soft.
 
Status
Not open for further replies.
Back
Top