Note that there are some explanatory texts on larger screens.

plurals
  1. POGroup form elements in JS
    primarykey
    data
    text
    <p>I have JQuery Mobile/PHP/MySQL site with a long list of similar forms (with different input values but not different element ids). Two examples below. I could have the buttons submit the forms but since it's a very long list that I don't want to reload every time a button is clicked I would prefer to use JS/AJAX calls to add/delete values in the database. If I use JS for this, is there a way to get the input values from a specific form sent to the function called by the button in this form?</p> <pre><code> &lt;form&gt; &lt;div class="ui-grid-a"&gt; &lt;div class="ui-block-a"&gt; &lt;div data-role="fieldcontain"&gt; &lt;input name="field1" placeholder="" value="value1" type="text"&gt; &lt;/div&gt; &lt;div data-role="fieldcontain"&gt; &lt;input name="field2" placeholder="" value="value2" type="text"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="ui-block-b"&gt; &lt;a data-role="button"&gt; Add &lt;/a&gt; &lt;a data-role="button"&gt; Delete &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;form&gt; &lt;div class="ui-grid-a"&gt; &lt;div class="ui-block-a"&gt; &lt;div data-role="fieldcontain"&gt; &lt;input name="field1" placeholder="" value="value1" type="text"&gt; &lt;/div&gt; &lt;div data-role="fieldcontain"&gt; &lt;input name="field2" placeholder="" value="value2" type="text"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="ui-block-b"&gt; &lt;a data-role="button"&gt; Add &lt;/a&gt; &lt;a data-role="button"&gt; Delete &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&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.
    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