I am trying to change CSS of button using jquery, but i am not able to find the button using text property, my JQuery is:
$.ajax({
url : "{{url('booktable')}}",
type : "GET",
data : {},
success : function(data){
$.each(data, function(index, element){
if(element.table_aval == 0)
{
var elmt = element.table_no;
$('#table button[text='+elmt+']').css('color','red');
}
});
}
});
buttons are group of button created by foreach loops, thats why I am trying to find it using text attribute, how can i do that, buttons are:
<tbody>
@foreach($tables as $table)
<tr id="">
<!--input type="hidden" name="table_no" id="tno" value=""-->
<td style="text-align: center;">
<button class="btn" >{{$table->table_no}} </button>
</td>
</tr>
@endforeach
</tbody>