Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd text to input field instead of replacing it with ListView + jQuery Mobile
    primarykey
    data
    text
    <p>What I am trying to accomplish:</p> <p>Clicking a button adds a word to filter the jQuery Mobile ListView.</p> <p>HTML:</p> <pre><code>&lt;ul data-role="listview" data-theme="a" data-divider-theme="c"&gt; &lt;li data-role="list-divider" data-inset="true"&gt; &lt;div data-role="controlgroup" data-type="horizontal" data-mini="true" id="filterButton"&gt; &lt;a href="#" data-role="button" data-inline="true"&gt;Iedereen&lt;/a&gt; &lt;a href="#" data-role="button" data-inline="true"&gt;LinkedIn&lt;/a&gt; &lt;a href="#" data-role="button" data-inline="true"&gt;Facebook&lt;/a&gt; &lt;a data-role="button" style="width: 4px;"&gt;&lt;/a&gt; &lt;a href="#" data-role="button" data-inline="true" class="filterAdd"&gt;Design&lt;/a&gt; &lt;a href="#" data-role="button" data-inline="true"&gt;Development&lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;ul data-role="listview" data-filter="true" data-theme="d" data-divider-theme="d" data-filter-placeholder="Search Connections..."&gt; &lt;li data-theme="b"&gt;&lt;a href="index.html"&gt; &lt;img src="http://a0.twimg.com/profile_images/1353509401/DSC_3465_bigger.jpg" class="ui-li-thumb zapp-corner zapp-margin-5 zapp-inner-shadow" /&gt; &lt;h3&gt;Stephen Weber&lt;/h3&gt; &lt;p&gt;&lt;strong&gt;You've been invited to a meeting at Filament Group in Boston, MA&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the jQuery team.&lt;/p&gt; &lt;p class="ui-li-aside"&gt;&lt;strong&gt;LinkedIn&lt;/strong&gt;&lt;/p&gt; &lt;/a&gt;&lt;/li&gt; </code></pre> <p></p> <p>JavaScript</p> <pre><code>$(document).ready(function () { $("#filterButton").delegate("a", "click", function () { $("div.ui-input-search").find("input").val($(this).text()); $("div.ui-input-search").find("input").keyup(); }); }); </code></pre> <p>At this moment it replaces the whole value inside the input field instead of adding it to the existing value.</p> <p><a href="http://jsfiddle.net/J4HZp/6/" rel="nofollow">http://jsfiddle.net/J4HZp/6/</a></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.
    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