Note that there are some explanatory texts on larger screens.

plurals
  1. PO.each() to search for a background color
    primarykey
    data
    text
    <p>I am looking for the highlighted element. I cannot seem to get inside the <code>.each()</code> function. Do I need to navigate down to the .<code>resultsselected</code> div since it's inside of a div itself? I am at a loss.</p> <pre><code>$(document).ready(function () { console.log('ready '); $('.resultsselected [background-color]').each(function() { var match = 'Green'; // match background-color: console.log(' looking '); if ($(this).css('background-color') == match) { $(this)[0].scrollIntoView(); console.log(' found it '); } else console.log(' nope '); }); }); </code></pre> <p>All of this is in a <code>ListView</code> Here is my <code>SelectedItemTemplate</code></p> <pre><code> &lt;SelectedItemTemplate&gt; &lt;div class="results resultsselected"&gt; &lt;asp:LinkButton ID="LineLinkButton" runat="server"&gt; &lt;asp:Label ID="" runat="server" Text='&lt;%# %&gt;' /&gt; &lt;asp:Label ID="" runat="server" Text='&lt;%# %&gt;' /&gt; &lt;asp:Label ID="" runat="server" Text='&lt;%# %&gt;' /&gt; &lt;asp:Label ID="" runat="server" Text='&lt;%# %&gt;' /&gt; &lt;/asp:LinkButton&gt; &lt;/div&gt; &lt;/SelectedItemTemplate&gt; </code></pre> <p>My <code>ItemTemplate</code> is similar but without the <code>resultsselected</code> class just the <code>results</code> class.</p> <p>EDIT: I took out the <code>.each()</code> and now I get in the console <em>ready</em> <em>looking</em> <em>nope</em></p> <pre><code>$(document).ready(function () { console.log('ready '); var match = 'rgb(0, 128, 0)'; // match background-color: console.log(' looking '); if ($('.resultsselected [background-color]').css('background-color') == match) { $('.resultsselected [background-color]')[0].scrollIntoView(); console.log(' found it '); } else console.log(' nope '); }); </code></pre> <p>I type this into my console </p> <pre><code>$('.resultsselected').css('background-color') </code></pre> <p>and get this</p> <pre><code>"rgb(0, 128, 0)" </code></pre> <p>I am really not understanding now.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload