I have HTML table where I need to select a row and send its first cell ID to a button and onclick of the button send the selected value to a function in Javascr
In my case $(document).ready(function() was missing. Try this.
$(document).ready(function(){
("#table tr").click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
var value=$(this).find('td:first').html();
alert(value);
});
$('.ok').on('click', function(e){
alert($("#table tr.selected td:first").html());
});
});