I have a table skeleton created in the HTML and then added options based on JSON data in my js. I currently have the rows &amp; options for the table created from that js, so that the data can be dynamic.   Eventually I'd like to have data show/do something after you hover a row. I decided to just try and implement a background-color change for now, to verify it works.   However, I'm running into some issues. It's not able to recognize the different rows inside my table.   Here's a code pen link,   Is this due to how I'm creating the rows &amp; options inside my javascript?  If I change it to look for ".tr", it only finds the header row. If I change it to look for ".tbody", it affects the whole body.  I also tried creating a class when my js appends the tr, which you can see in the code shown here. This provided 0 highlighting.  $(".myRows").hover(   function() {     console.log('hover called');     $( this ).css("background","yellow" );   }, function() {     $( this ).css( "background","" );   } );
112
I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.
78791
I am trying to create a table with specific cells coloured either green or red. As a trial, I used the following code to colour one cell green \documentclass[a4paper,12pt]{extarticle} %% Language and font encodings \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage[T1]{fontenc}  %% Sets page size and margins \usepackage[a4paper,top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm,marginparwidth=1.75cm]{geometry}  \usepackage{amsmath} \usepackage{amsfonts}  \usepackage{amssymb} \usepackage{amsthm} \usepackage{mathtools} \usepackage{optidef}  \usepackage[framed,numbered,autolinebreaks,useliterate]{mcode} \usepackage[table]{xcolor}  \begin{document} \begin{table} \centering \begin{tabular}{ | l | l | l | }       \hline       A &amp; B &amp; C \\       \hline       D &amp; E &amp; \cellcolor{green}F \\       \hline       G &amp; H &amp; I \\       \hline \end{tabular} \end{table} \end{document}  Here I have used \usepackage[table]{xcolor}. This did not work, and the output generated is shown below  Is there a way to create a table with specific cell colours
27229
I've created a table where the rows alternate in colour however /hline is acting unusually.  The first and second /hline work normally however after this alternating /hlines only show as a small dash next to the vertical column line  \usepackage[table]{xcolor}  \begin{table}[ht]    \rowcolors{2}{gray!25}{white}   \begin{tabular}{l | l|}     \hline     \rowcolor{gray!25}     text part 1 &amp; test part 2  \\                    Priority &amp; High \\ \hline     text part 1 &amp; test part 2  \\                    Priority &amp; High \\ \hline %this hline doesnt show     text part 1 &amp; test part 2  \\                    Priority &amp; High \\ \hline     text part 1 &amp; test part 2  \\                    Priority &amp; High \\ \hline %this hline doesnt show     text part 1 &amp; test part 2  \\                    Priority &amp; High \\ \hline     text part 1 &amp; test part 2  \\                    Priority &amp; High \\ \hline   \end{tabular}   \end{table}   Does anybody know what I'm doing wrong? Thanks.
39221
So, I can create an input button with an image using &lt;INPUT type=&quot;image&quot; src=&quot;/images/Btn.PNG&quot; value=&quot;&quot;&gt;  But, I can't get the same behavior using CSS. For instance, I've tried &lt;INPUT type=&quot;image&quot; class=&quot;myButton&quot; value=&quot;&quot;&gt;  where &quot;myButton&quot; is defined in the CSS file as .myButton {     background:url(/images/Btn.PNG) no-repeat;     cursor:pointer;     width: 200px;     height: 100px;     border: none; }  If that's all I wanted to do, I could use the original style, but I want to change the button's appearance on hover (using a myButton:hover class). I know the links are good, because I've been able to load them for a background image for other parts of the page (just as a check). I found examples on the web of how to do it using JavaScript, but I'm looking for a CSS solution. I'm using Firefox 3.0.3 if that makes a difference.
80378
I'm cleaning up my big crazy style sheets (possibly pertinent to a future question) and I'm wondering the best way to add custom CSS to a specific node or page. In particular, my work site's home page is a Panel Page and it has a bunch of different styling. Right now the CSS is just included with the main theme style sheet. Is there a way to say, &quot;if this is node Foo, then add foo.css&quot;? Is  what I'm looking for? I might be interested in generalizing this to other nodes/sections/etc, but at the moment I just want to handle this one item.
36025
I am trying to color a multirow in my table, but without success until now: \documentclass{scrartcl} \usepackage[utf8]{inputenc} \usepackage{multirow} \usepackage{hhline} \usepackage{colortbl} \usepackage{multicol} \begin{document} \begin{table} \begin{tabular}{|l|c|c|c|c|} \hline \multicolumn{5}{|c|}{Type} \\ \hline   &amp; A  &amp;    B &amp; C &amp; D \\     \hline     X &amp; 53,2\%  &amp;   51,6\%  &amp;  \multirow{2}{*}{\cellcolor[gray]{.9}49\%} &amp; \multirow{2}{*}{\cellcolor[gray]{0.9}49\% }\\     Y  &amp; 53,8\%  &amp;  52,2\%  &amp;  &amp; \\ \hline \end{tabular} \end{table} \end{document}   What should I do, so that the two last multirow-cells get completely grey-colored?
30365
This is a bug report originating from   In the reputation tab, When a user hovers over a row of his rep:    the cursor changes to a pointer. The problem around the pointer is that The table-row  has the class expandable-row which actually sets the cursor to pointer. But only the post body is actually expandable. Therefore, clicking on the row does not work. You need to click on the post body (or the arrow to the left of it).  Either the row should be made expandable by clicking anywhere on it, or the cursor should not change to pointer on hovering over the row, instead it should do so only on hovering over the rep-body cell.
37877
I have an image URL in a imageUrl variable and I am trying to set it as CSS style, using jQuery:  $('myObject').css('background-image', imageUrl);   This seems to be not working, as:  console.log($('myObject').css('background-image'));   returns none.  Any idea, what I am doing wrong?
82056
I'm brand new to jQuery and have some experience using Prototype. In Prototype, there is a method to "flash" an element &mdash; ie. briefly highlight it in another color and have it fade back to normal so that the user's eye is drawn to it. Is there such a method in jQuery? I see fadeIn, fadeOut, and animate, but I don't see anything like "flash". Perhaps one of these three can be used with appropriate inputs?
96273
I need to implement a custom block using JavaScript. These are the steps I took.   I created a custom module I created a custom block by creating a class which extends blockbase I created a JavaScript file I defined a library in libraries.yml file and included the JavaScript file I attached the library to the block using #attached   So far so good. In the JavaScript file, I am trying to use the open source Datatables library, but I am unable to add it.  This is the code that implements the block.  /**  * @file  * Contains \Drupal\custom_cms_blocks\Plugin\Block\TopNewsBlock.  */  namespace Drupal\custom_cms_blocks\Plugin\Block;  use Drupal\Core\Block\BlockBase;  /**  * Provides an 'Active forum topics' block.  *  * @Block(  *   id = "top_news_min_block",  *   admin_label = @Translation("Top News Min Block"),  *   category = @Translation("Custom CMS blocks"),  * )  */ class TopNewsBlock extends BlockBase {    /**    * {@inheritdoc}    */   public function build() {      //Fetch data      return array(       'type' =&gt; 'markup',       '#markup' =&gt; '&lt;table id="example_table"&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Artist / Band&lt;/th&gt;&lt;th&gt;Album&lt;/th&gt;&lt;th&gt;Song&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Muse&lt;/td&gt;&lt;td&gt;Absolution&lt;/td&gt;&lt;td&gt;Sing for Absolution&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;',       '#attached' =&gt; array(         'library' =&gt;  array(                 'https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js',           'custom_cms_blocks/top-news-library'         ),       ),      );    }   }   Can you explain me how I can include an external JavaScript file in a block?
5149
I want to use row coloring with \multicolumn. The MWE below works, but if I change  to the commented, colored line, I receive a "misplaced \noalign". What do I wrong?  \documentclass{article} \usepackage{booktabs,colortbl,xcolor} \begin{document}  \begin{tabular}{p{1.7cm}p{1.3cm}p{1.3cm}p{1.35cm}p{1.35cm}p{1.35cm}p{1.35cm}p{1.7cm}} % \toprule % \multicolumn{1}{&gt;{\rowcolor{lightgray}}c}{}  &amp;\multicolumn{7}{&gt;{\rowcolor{lightgray}}c}{String length}\\  \multicolumn{1}{c}{}  &amp;\multicolumn{7}{c}{String length}\\ \rowcolor{lightgray} Function &amp; 16,384 &amp; 32,768&amp; 65,536 &amp; 130,072 &amp; 262,144 &amp; 524,288&amp; 1,048,576\\ \midrule lower1  &amp; 0.19 &amp; 0.77 &amp; 3.08 &amp; 12.24 &amp; 49.39 &amp; 198.42 &amp; 791.22\\ lower2&amp; 0.0000 &amp;  0.0000 &amp; 0.0001 &amp; 0.0002 &amp; 0.0004 &amp; 0.0008 &amp; 0.0015\\ \bottomrule \end{tabular}  \end{document}   I was experimenting with a solution like this, because I receive strange table heading, like below. The code you suggested works fine in MWE, but in my real text, with copy&amp;paste from the answer, it produces the strange heading. Any idea, what can change the behavior?
10567
It's easy to set inline CSS values with javascript. If I want to change the width and I have html like this:  &lt;div style="width: 10px"&gt;&lt;/div&gt;   All I need to do is:  document.getElementById('id').style.width = value;   It will change the inline stylesheet values. Normally this isn't a problem, because the inline style overrides the stylesheet. Example:  &lt;style&gt;    #tId {       width: 50%;    } &lt;/style&gt;  &lt;div id="tId"&gt;&lt;/div&gt;   Using this Javascript:  document.getElementById('tId').style.width = "30%";   I get the following:  &lt;style&gt;    #tId {       width: 50%;    } &lt;/style&gt;  &lt;div id="tId" style="width: 30%";&gt;&lt;/div&gt;   This is a problem, because not only do I not want to change inline values, If I look for the width before I set it, when I have:  &lt;div id="tId"&gt;&lt;/div&gt;   The value returned is Null, so if I have Javascript that needs to know the width of something to do some logic (I increase the width by 1%, not to a specific value), getting back Null when I expect the string "50%" doesn't really work.  So my question: I have values in a CSS style that are not located inline, how can I get these values? How can I modify the style instead of the inline values, given an id?
6047
I'm interested in learning about some nice-looking table samples. Colors can make a huge difference, and just providing some color to headers, background, or borders can dramatically change presentation. Any samples you're proud to share?  (BTW here's a sample I like, but unfortunately, not TeX...)
6286
I am trying to animate a change in backgroundColor using jQuery on mouseover.  I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working with is a div.  $(".usercontent").mouseover(function() {     $(this).animate({ backgroundColor: "olive" }, "slow"); });   Any ideas?
38062
Possible Duplicate:          I have a spreadsheet where I have cell within a row that will contain specific text via data validation. So for instance a cell could contain the text "Due in 7 Days", "Past Due", or "Closed".  I want the row color to change depending on the text that appears in the cell. So if the text "Past Due" appears in the cell I want that entire row to turn red, if "Due In 7 Days" appears the row should turn yellow, and if "Closed" the row would turn gray.  How can I do that?
47609
Sometimes you can see in books tables, that have alternating background color for rows in a table to support readability. How I can achieve this with LaTeX?  And yes, I could put macros \odd and \even into each row, but in that case I would have to change all following rows, if I input later another row into the table. I want TeX to decide itself, which row is odd or even and put the appropiate style into it.
110876
I've created the following table:  \begin{table}[htb] \centering \begin{tabular}{cc|c|c|c|c|} \cline{3-6} &amp;                                          &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col1 }  &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col2 }  &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col3 }  &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col4 }  \\ \hline \rowcolor[HTML]{FFFFFF}  \multicolumn{1}{|c|} {\cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} }}                        &amp; sub-row-1                    &amp; -                                                        &amp; -                                                         &amp; -                                                      &amp; -                                                               \\ \cline{2-6}  \rowcolor[HTML]{CEE3FF}  \multicolumn{1}{|c|} {\multirow{-2}{*}{\cellcolor[HTML]{3166FF} {\color[HTML]{FFFFFF} row-1}}}  &amp;  {\color[HTML]{000000} sub-row-2} &amp;  {\color[HTML]{000000} -}                                &amp;  {\color[HTML]{000000} -}                                 &amp;  {\color[HTML]{000000} -}                              &amp;  {\color[HTML]{000000} -}                                        \\ \hline  \end{tabular} \caption{} \label{} \end{table}  As you can see from the picture below, when I compile the document in PDF, in the cell &quot;row-1&quot; there is a white row due to the merge of two cells.  How can i remove this line? The command that I'm using to compile the document is: pdflatex &lt;document_name&gt;  Thank you in advance