jquery - How to get an array of all selected values of all dropdownlists in div -



jquery - How to get an array of all selected values of all dropdownlists in div -

here's i'm trying parse jquery:

<tr> <td>5</td> <td>abc@abc.com</td> <td>asdfasdf asdfasdf</td> <td> <div class="roleoption"> <img src="/public/images/delete.png" alt="delete" /> <select id="role" name="role"> <option value="1">anonimo</option> <option value="2">registrado</option> <option value="3">tecnico</option> <option value="4">empresario</option> <option selected="selected" value="5">editor</option> <option value="6">financias</option> <option value="7">administrador</option> </select> </div> <img class="add-role" src="/public/images/add.png" alt="add" /> </td> </tr>

and javascript code:

select td tr first td's value? var userid = $(this).parent().parent().select

that's getting user id, can't seem figure out how select elements.

then need grab each .val() of every select within td. like:

$(this).parent().find('select').each().val();??

how can wrap code , homecoming like:

//save array of values: { user: 4, roles { rol: 1, rol: 3, rol: 6 } }

i intend utilize array of values in ajax request.

you this:

var selectvalues = new array(); $('div.roleoption').find('select').each(function() { selectvalues.push($(this).val()); }

there's much improve way of doing same thing in jquery, should work.

jquery html select selector

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -