Hi I would like to change the background color of the search field on top of the column when it contains a search term. When its empty it should return to transparent. How may I accomplish this?
I tried
jQuery(document).ready(function(){
if(jQuery("th.ui-state-default.ui-th-column.ui-th-ltr").val()!="")
{jQuery(this).css('background-color','#00FF00');}
else
{jQuery(this).css('background-color','#0000ffff');}
});
Thank you
Hi,
I don't understand exactly what you are trying to get … but the jquery selector will also have input at end:
Replace:
if(jQuery("th.ui-state-default.ui-th-column.ui-th-ltr").val()!="")
{…}
With:
if(jQuery("th.ui-state-default.ui-th-column.ui-th-ltr input").val()!="")
{…}
I tried your recommendation
jQuery(document).ready(function(){
if(jQuery("th.ui-state-default.ui-th-column.ui-th-ltr input").val()!="")
{jQuery(this).css('background-color','#00FF00');}
else
{jQuery(this).css('background-color','#0000ffff');}
});
but it didn't work.
The aim is of the code is to check if any of the search fields on top of the grid columns has a value .
If there is a value then the background color changes for emphasis and remains changed as long as a non-null or non-zero value is there.