Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat am I missing to apply this JQuery widget to dynamic elements?
    primarykey
    data
    text
    <p>I have the following script:</p> <pre><code>$(function() { $( 'input[id^="event_"' ).each(function() { this.datetimepicker({ stepMinute: 15 }); }); }); </code></pre> <p>Typically applying the <code>datetimepicker</code> widget involves this code (which is working further up on the page):</p> <pre><code>$(function() { $( "#datepicker" ).datetimepicker({ stepMinute: 15 }); }); </code></pre> <p>What it should be doing is applying the <code>datetimepicker</code> widget to each of the input boxes in this generated code:</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;td&gt;Event Name&lt;/td&gt; &lt;td&gt;Event Date&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" id="1" value="Opening" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="event_1" value="2011-09-15 20:30:00" /&gt;&lt;/td&gt; &lt;td&gt;Save stuff here?&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" id="2" value="First Act" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="event_2" value="2011-09-15 20:45:00" /&gt;&lt;/td&gt; &lt;td&gt;Save stuff here?&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" id="3" value="Some Event" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="event_3" value="2011-09-16 20:00:00" /&gt;&lt;/td&gt; &lt;td&gt;Save stuff here?&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" id="4" value="Some Other Event" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="event_4" value="2011-09-17 20:00:00" /&gt;&lt;/td&gt; &lt;td&gt;Save stuff here?&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" id="30" value="1234" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="event_30" value="2011-09-30 11:00:00" /&gt;&lt;/td&gt; &lt;td&gt;Save stuff here?&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" id="32" value="Statement Check" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="event_32" value="2011-09-29 10:30:00" /&gt;&lt;/td&gt; &lt;td&gt;Save stuff here?&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>I am 95% sure that my syntax is wrong in the <code>$(function() { ... });</code> block, but I am not sure where I went wrong.</p> <p>EDIT: As a side note, this will eventually edit the listed events via an AJAX call. So each row is an event that needs individual saving once edited.</p> <p>Thank you all in advanced for all input/suggestions/solutions!</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