Note that there are some explanatory texts on larger screens.

plurals
  1. POonclick function added by jquery is being called twice
    primarykey
    data
    text
    <pre><code>var filters_used = new Array(); $('#filter-text').keyup(function(k) { $('#error').html(''); if (k.keyCode == 13) { $('#add-filter').click(); } }); function reg_remove() { $('.remove-filter').click(function() { console.debug("remove-filter.click()"); var col = $(this).children('td:nth-child(2)').html(); var index = $.inArray(col, filters_used); filters_used.splice(index, 1); $(this).parents('.filter').remove(); return false; }); } function check_value() { var flag = true; var value = $('#filter-text').val(); var col = $('#filter-type').val(); var reg = /[^0-9a-zA-Z\s\-]/; if (value.match(reg) || value.trim() === "") { flag = false; $('#error').html('Only letters, numbers, spaces, and dashes (-) are allowed.'); } else if ($.inArray(col, filters_used) &gt;= 0) { flag = false; $('#error').html('That column is already being filtered.'); } return flag; } $('#add-filter').click(function() { if (check_value()) { var value = $('#filter-text').val(); var col = $('#filter-type').val(); $('#filter-text').val(''); appendstr = '&lt;tr class="filter"&gt;&lt;td&gt;' + value + '&lt;/td&gt;&lt;td&gt;' + col + '&lt;/td&gt;&lt;td&gt;' + '&lt;a href="" class="remove-filter"&gt;Remove&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;'; $('#filter-form').after(appendstr); filters_used.push(col); reg_remove(); //queryDB(); } }); function get_filters() { }? </code></pre> <p><a href="http://jsfiddle.net/nosepickle/eZ5SA/21" rel="nofollow">Link to a fiddle containing my code</a><br/> I am trying to let users create a list of filters, essentially. Adding them seems to work fine, however the remove() function only works properly when there is only one filter item. If you create a first, then click remove on the bottom item, the onclick() function for that item is called twice, and I can't for the life of me figure out why.</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.
    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