title: JQuery is not working in php while loop
body: <p>I am trying to use JQuery autocomplete function for a editable table. My table has multiple rows(the count is variable). I am using while loop to get the data from the database, My JQuery function is placed outside the loop. But the autocomplete operation is working only for the first row.</p>
  
  <p>Is there any suggestion to call the function in every row? I want the autocomplete operation to happen in every row.</p>
  
  <p>Please suggest me as I am very new to this.</p>
  
  <p>Here is my code</p>
  
  <pre><code>            &lt;?php
              $connect = mysqli_connect("localhost", "root", "A", "ABC");
              $output = '';
              $sql = "SELECT * FROM PROVISIONING WHERE COMMENTS='NOT_UPDATED' AND UPDATED_BY='NOT_UPDATED' ORDER BY id DESC";
              $result = mysqli_query($connect, $sql);
              $output .= '
              &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
              &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
              &lt;script&gt;
              $( function() {
                  var availableTags = [
                      "Arindam",
                  "Completed",
                  "Pending"
                                          ];
                  $( "#tags" ).autocomplete({
                  source: availableTags
                  });
                  $( "#tags1" ).autocomplete({
                  source: availableTags
                  });
                  $( "#tags2" ).autocomplete({
                  source: availableTags
                  });
                  $( "#tags3" ).autocomplete({
                  source: availableTags
                  });
  
              } );
              &lt;/script&gt;
              &lt;div class="ui-widget"&gt;
              &lt;table align="middle" border="1" bordercolor="green" class="table table-bordered"&gt;
              &lt;tr&gt;
              &lt;th style="color:blue;font-style:italic;" hidden&gt;Id&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Task ID&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Request ID&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;END Date&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Updated Date&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Pending Tasks&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Comments&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Assignee&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;"&gt;Updated By&lt;/th&gt;
              &lt;th style="color:blue;font-style:italic;" hidden&gt;Delete&lt;/th&gt;
              &lt;/tr&gt;';
  
              if(mysqli_num_rows($result) &gt; 0)
              {
                  while($row = mysqli_fetch_array($result))
                  {
              $output .= '
              &lt;tr&gt;
              &lt;td hidden&gt;'.$row["id"].'&lt;/td&gt;
              &lt;td class="TASK_ID" data-id1="'.$row["id"].'" &gt;'.$row["TASK_ID"].'&lt;/td&gt;
              &lt;td class="REQUEST_ID" data-id2="'.$row["id"].'" &gt;'.$row["REQUEST_ID"].'&lt;/td&gt;
              &lt;td class="END_DATE" data-id3="'.$row["id"].'" &gt;'.$row["END_DATE"].'&lt;/td&gt;
              &lt;td class="UPDATED_DATE" data-id4="'.$row["id"].'" contenteditable&gt;'.$row["UPDATED_DATE"].'&lt;/td&gt;
              &lt;td id="tags" class="AUTOMATED_TASKS" data-id5="'.$row["id"].'" contenteditable&gt;'.$row["AUTOMATED_TASKS"].'&lt;/td&gt;
              &lt;td id="tags1" class="COMMENTS" data-id6="'.$row["id"].'" contenteditable&gt;'.$row["COMMENTS"].'&lt;/td&gt;
              &lt;td id="tags2" class="ASSIGNEE" data-id7="'.$row["id"].'" contenteditable&gt;'.$row["ASSIGNEE"].'&lt;/td&gt;
              &lt;td id="tags3" class="UPDATED_BY" data-id8="'.$row["id"].'" contenteditable&gt;'.$row["UPDATED_BY"].'&lt;/td&gt;
              &lt;td hidden&gt;&lt;button type="button" name="delete_btn" data-id9="'.$row["id"].'" class="btn btn-xs btn-danger btn_delete"&gt;x&lt;/button&gt;&lt;/td&gt;
              &lt;/tr&gt;';
              }
              $output .= '
              &lt;tr&gt;
              &lt;td id="TASK_ID" contenteditable&gt;&lt;/td&gt;
              &lt;td id="REQUEST_ID" contenteditable&gt;&lt;/td&gt;
              &lt;td id="END_DATE" contenteditable&gt;&lt;/td&gt;
              &lt;td id="UPDATED_DATE" contenteditable&gt;&lt;/td&gt;
              &lt;td id="AUTOMATED_TASKS" contenteditable&gt;&lt;/td&gt;
              &lt;td id="COMMENTS" contenteditable&gt;&lt;/td&gt;
              &lt;td id="ASSIGNEE" contenteditable&gt;&lt;/td&gt;
              &lt;td id="UPDATED_BY" contenteditable&gt;&lt;/td&gt;
              &lt;td hidden&gt;&lt;button type="button" name="btn_add" id="btn_add" class="btn btn-xs btn-success"&gt;+&lt;/button&gt;&lt;/td&gt;
              &lt;/tr&gt;';
              }
              else
              {
              $output .= '&lt;tr&gt;
              &lt;td colspan="4"&gt;Data not Found&lt;/td&gt;
              &lt;/tr&gt;';
              }
              $output .= '&lt;/table&gt;
              &lt;/div&gt;';
              echo $output;
              ?&gt;
  </code></pre>