JavaScript code for getting the selected value from a combo box

combobox, javascript

Solution

There is an unnecessary hashtag; change the code to this:

var e = document.getElementById("ticket_category_clone").value;

Problem

Can any one give me a sample code that gets the selected value from an existing combo box? I have this code but its not doing anything: ``` function check () { var e = document.getElementById("ticket_category_clone"); var str = e.options[e.selectedIndex].text; alert(str); if (str==="Hardware") { SPICEWORKS.utils.addStyle('#ticket_c_hardware_clone{display: none !important;}'); } } SPICEWORKS.app.helpdesk.ready(check);​ ``` heres a img of the code and the code ``` <select id="ticket_category_clone" name="ticket[category]" hdpp="ticket_category"> <option value=""></option><option value="Hardware">Hardware</option> <option value="Software">Software</option> <option value="Rede" selected="selected">Rede</option> <option value="Pedidos">Pedidos</option> <option value="Formação/Dúvida">Formação/Dúvida</option> <option value="Outro">Outro</option><option value="#edit_categories#">Edit Categories...</option></select> ``` what i want its find a way to get the selected value fo that combobox

Original source