开发者

jQuery highlight row based on header $_GET variable

I have small dashboard of recently added records and I want to highlight the table row based on a header $_GET variable.

I already have one header, called myVariable, so I propose using an &myVariable2 ?

index.php?**myVariable**=1&**myVariable2**=2

When this URL is visited, it highlights the row with the record of $myID.

How do I get jQuery to highlight the row (Background colour is fine) base开发者_C百科d on $myID (header)? If this isn't possible I can always add it into a variable and do something with jQuery.

I have the ID in a $variable, and need to highlight the row with that $variable. $row[variableID] in mysql.


Something like

 $(".rows[data-id='<?php echo intval($_GET['highlight']); ?>']").css('background-color', 'yellow');

would be fine. Just add data-id to your .rows and change $_GET['highlight'] to your one

Or instead of using php to get the query values, you can use javascript. See this question How can I get query string values in JavaScript?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜