Note that there are some explanatory texts on larger screens.

plurals
  1. POApply jQuery to created elements
    primarykey
    data
    text
    <p>Maybe kind of a stupid question, but i'm a beginner in jQuery and i'm trying to make a lightbox with a form in it. So far so good, but now i want to make a validation on the created form, but that's the problem. I create the form via the following method:</p> <p><pre><code> $("a").click(function(){ if(this.rel == "box"){ $("body").append('').append(''); $("#shadowContent").append('Sluit venster - Your total price is &euro;55,-').append(''); $("#closeBox").click(function(c) { c.preventDefault(); $("#shadow").add($("#shadowContent"),$("#closeBox")).fadeOut(500); }); $("#shadow").add($("#shadowContent")).fadeIn(500); $("#shadowContent").show().css({'width':'750px','top':'25px','left':'50%','margin-left':'-400px'}); $("#content").load('<a href="http://www.domain.nl/tmp/make" rel="nofollow noreferrer">http://www.domain.nl/tmp/make</a>'); </pre></code></p> <p>Now when i try adding the following code, just below the above code, the form submits and i don't get the required alert.</p> <p><pre><code> $("#reservationForm").submit(function(f){ f.preventDefault(); alert("Jawel"); }); </pre></code></p> <p>My form looks (simplified) like this:</p> <p><pre><code> <code>&lt;form id="reservationForm"</code>> <code>&lt;fieldset</code>> <code>&lt;legend</code>>Legend<code>&lt;/legend</code>> ... <code>&lt;/fieldset</code>> <code>&lt;fieldset</code>> <code>&lt;legend</code>>Legend<code>&lt;/legend</code>> ... <code>&lt;/fieldset</code>> <code>&lt;button type="submit"</code>> <code>&lt;/form</code>> </pre></code></p> <p>The whole form is in a new document (make.php) which is loaded in my lightbox through jQuery. How can i apply a validation to the fields in my form? I want to keep my jQuery in one file, so it would be nice if i not have to place the validation in make.php itself..</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