Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery function does not work for all fields of the same class
    primarykey
    data
    text
    <p>I have the following jQuery code to disable a submit button in a form when the values are empty. the code works fine for all entries except for <code>.action_manager</code> (which is a <code>textarea</code> generated dynamically in a table)in which by filling only the first row, the button is enabled. I want all the fields to be filled before the <code>submitbutton</code>is reactivated. <strong>Only one</strong> instance of <code>action_manager</code> is enough to get the button enabled ( which is <strong>not</strong> what I want)</p> <pre><code> $('document').ready(function(){ var submitButton = $('input[name="store_values"]'); checkValues(); $('select.actuallevel').on('change',function(){ checkValues(); }); $('select.targetlevel').on('change',function(){ checkValues(); }); $('select.quarter_manager').on('change',function(){ checkValues(); }); $('select.year_manager').on('change',function(){ checkValues(); }); $(".action_manager").each(function() { $(this).on('change',function(){ checkValues(); }); }); function checkValues(){ submitButton.prop('disabled',$(".actuallevel &gt; option:selected[value=''],.actuallevel:empty").length &gt; 0 || $(".targetlevel &gt; option:selected[value=''],.targetlevel:empty").length &gt; 0 || $(".quarter_manager &gt; option:selected[value=''],.quarter_manager:empty").length &gt; 0 || $(".year_manager &gt; option:selected[value=''],.year_manager:empty").length &gt; 0 || !$.trim($(".action_manager").val()) ); //submitButton.prop('disabled',$(".targetlevel &gt; option:selected[value=''],.targetlevel:empty").length &gt; 0); } }); </code></pre> <p>The textarea field is the following:</p> <pre><code>echo "&lt;td&gt;&lt;textarea class='action_manager' id='action-".$inf['Competence_ID']."' name='acto-".$inf['Competence_ID']."'&gt;";if (isset($inf['actiontext'])){echo $inf['actiontext'];}echo "&lt;/textarea&gt;&lt;/td&gt;"; echo"&lt;td&gt;"; </code></pre>
    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.
 

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