3
I have a table, with a select
, in each row, and by clicking a button I want to get all the items in the table where the select option
be of value.
<table id="myTable">
<span class="result"></span>
<thead>
<tr>
<th>Nome</th>
<th>Status</th>
<tr>
</thead>
<tbody>
<tr>
<td>xyz</td>
<td>
<select>
<option class="op" value="0">-- Selecione --</option>
<option class="op" value="1">-- Bloqueado --</option>
<option class="op" value="2">-- Ativo --</option>
</select>
</td>
</tr><tr>
<td>abc</td>
<td>
<select>
<option value="0">-- Selecione --</option>
<option value="1">-- Bloqueado --</option>
<option value="2">-- Ativo --</option>
</select>
</td>
</tr>
</tbody>
</table>
<span class="status"></span>
<button class="row" id="btnAdicionar" type="button" >Adicionar</button>
How can I sweep this my table and get all the items that are with select other than 0 ?
Show what you’ve done...
– Gabriel Katakura
@Gabrielkatakura already put the code, I have no idea how to do in jquery.
– Erico Souza
$("#myTable option[value!="0"]")
, this will select all elements with different values of "0"..– Marllon Nasser
@Marllonnasser but how do I get the value? For example, I mean if the ABC line is BLOCKED status. As I pass line by line, saying this ta active, this ta blocked... ?
– Erico Souza
you want all values, of all lines, that have different status of locked?
– Marllon Nasser