Note that there are some explanatory texts on larger screens.

plurals
  1. POLive text search jquery, wrong selector?
    primarykey
    data
    text
    <p>So i'm pretty new to this, please bear with me :)</p> <p>And it's kinda working for me, this is what I have:</p> <p>HTML:</p> <pre><code>&lt;form id="live-search" action="" class="styled" method="post"&gt; &lt;fieldset&gt; &lt;input type="text" class="text-input" id="filter" value="" placeholder="Søg efter skole..." /&gt; &lt;span id="filter-count"&gt;&lt;/span&gt; &lt;/fieldset&gt; </code></pre> <p></p> <p>jQuery:</p> <pre><code>$(document).ready(function(){ $("#filter").keyup(function(){ // Retrieve the input field text and reset the count to zero var filter = $(this).val(), count = 0; // Loop through the comment list $(".ss_voting_manual .ss_voting_entry_list").find("li").each(function(){ // If the list item does not contain the text phrase fade it out if ($(this).text().search(new RegExp(filter, "i")) &lt; 0) { $(this).fadeOut(); // Show the list item if the phrase matches and increase the count by 1 } else { $(this).show(); count++; } }); // Update the count var numberItems = count; $("#filter-count").text("Klasser fundet = "+count); }); }); </code></pre> <p>But when I make a search it do find the <code>li</code>, but it lose most of the style, if you see the <a href="http://imgur.com/ZWblB0d" rel="nofollow">screenshot</a> it will make better sense then I can do in writing.</p> <pre><code> &lt;div id="manual_voting" class="ss_voting_manual"&gt; &lt;ul class="ss_voting_entry_list"&gt; &lt;li class="my_db_entry item_handle_22924874" id="my_db_entry_22924874" style=""&gt; &lt;div class="entry_title entry_details"&gt; &lt;h4&gt;Koge Handelsskole - 3C&lt;/h4&gt; &lt;/div&gt; &lt;div class="entry_photo"&gt; &lt;ol&gt; &lt;li style="display: list-item;"&gt;&lt;img alt="" src= "https://d2ndy3xguswqvu.cloudfront.net/images/220405/22924874/original_89bf1593506cabda8ec9fd63ac6e35d0.png"&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;div class="entry_votes entry_details"&gt; &lt;span class="votes"&gt;65&lt;/span&gt; Stemmer &lt;/div&gt; &lt;div class="entry_description entry_details ss_preserve_ws"&gt;&lt;/div&gt; &lt;div class="itemActions entry_actions"&gt; &lt;ul&gt; &lt;li class="item_vote" style="display: inline;"&gt;&lt;a class="vote_link vote" href="#" onclick= "SST.vote_for(widget_14972805, 22924874, this); return false;"&gt;Stem&lt;/a&gt;&lt;/li&gt; &lt;li class="item_share" style="display: inline;"&gt;&lt;a class="share_link" href= "#" onclick="ss_share(widget_14972805, 22924874); return false;"&gt;Del med dine venner&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;li class="my_db_entry item_handle_22924821" id="my_db_entry_22924821" style= "display: list-item;"&gt; &lt;div class="entry_title entry_details"&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;div class="ss_voting_paging" id="paging_voting"&gt;&lt;/div&gt; </code></pre> <p></p>
    singulars
    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.
 

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