I have this table
function highlight(e) {
if (selected[0]) selected[0].className = '';
e.target.parentNode.className = 'selected';
}
var table = document.getElementById('table'),
selected = table.getElementsByClassName('selected');
table.onclick = highlight;
function fnselect(){
var $row=$(this).parent().find('td');
var clickeedID=$row.eq(0).text();
// alert(clickeedID);
}
$("#tst").click(function(){
var value =$(".selected td:first").html();
value = value || "No row Selected";
alert(value);
});
.selected {
background-color: brown;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="table">
<tr>
<td>1 Ferrari F138</td>
<td>1 000€</td>
<td>1 200€</td>
<td>Model monopostu stajne Scuderia Ferrari pre sezónu 2013</td>
<td>1</td>
<td>F138</td>
<td>Klik pre detaily</td>
<td><select name="sel" id="sel" >
<option value="1">Seleccion</option>
<option value="2">123</option>
<option value="3">456</option>
</select>
</td>
</tr>
<tr>
<td>2 Ferrari F138</td>
<td>1 000€</td>
<td>1 200€</td>
<td>Model monopostu stajne Scuderia Ferrari pre sezónu 2013</td>
<td>1</td>
<td>F138</td>
<td>Klik pre detaily</td>
<td><select name="" id="hola">
<option value="1">Seleccion</option>
<option value="2">123</option>
<option value="3">456</option>
</select>
</td>
</tr>
<tr>
<td>3 Ferrari F138</td>
<td>1 000€</td>
<td>1 200€</td>
<td>Model monopostu stajne Scuderia Ferrari pre sezónu 2013</td>
<td>1</td>
<td>F138</td>
<td>Klik pre detaily</td>
<td><select name="" id="hola">
<option value="1">Seleccion</option>
<option value="2">123</option>
<option value="3">456</option>
</select>
</td>
</tr>
</table>
<input type="button" id="tst" value="OK" onclick="fnselect()" />
When I click the button OK
brings me only the first value of the selected table. I'm trying to make him bring me all the values including the value of the select.
For example so that it does not bring me all the data of the select which are 123
and 456
show me only the selected one. and not the 2 values