Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Change this line:</p> <pre><code>$("#doContact").click(function(e) { </code></pre> <p>to this:</p> <pre><code>$("#contactForm").submit(function(e) { </code></pre> <p>Also change the button: <code>&lt;button id="doContact"</code> to a submit button: <code>&lt;input type="submit"&gt;</code></p> <p><strong>EDIT:</strong> I am not sure how you're trying to accomplish this, but this how I would do it - this works:</p> <pre><code>&lt;div id="output"&gt;&lt;/div&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; // 1. Load the form.html file, and grab the form with an id of '#contactForm' // 2. Insert the form with id '#contactForm' into the div with id '#output' // 3. Submit the form $('#output').load('form.html #contactForm', function (html, status, xhr) { $('#contactForm').submit(function(e) { e.preventDefault(); alert('Form has been submitted!'); }); }); &lt;/script&gt; </code></pre> <p>Your <strong>form.html</strong></p> <pre><code>&lt;div class="leftArea centered"&gt; &lt;h2&gt;İletişim&lt;/h2&gt; &lt;form id="contactForm" action="#" method="post" class="centered stylish"&gt; &lt;div&gt; &lt;p&gt;&lt;label for="username" class="label"&gt;Adınız:&lt;/label&gt; &lt;input id="username" placeholder="Adınız..." name="username" maxlength="20" type="text" tabindex="1" class="input" /&gt;&lt;/p&gt; &lt;p&gt;&lt;label for="email" class="label"&gt;Email: (geri dönüş için gerekli)&lt;/label&gt; &lt;input id="email" placeholder="Email adresiniz..." name="email" maxlength="70" type="text" tabindex="2" autocomplete="off" class="input"/&gt;&lt;/p&gt; &lt;p&gt;&lt;label for="message" class="label"&gt;Mesajınız:&lt;/label&gt; &lt;textarea id="message" placeholder="Mesajınız..." cols="60" rows="10" name="message" maxlength="1000" type="text" tabindex="2" autocomplete="off" class="input"/&gt;&lt;/p&gt; &lt;p&gt; &lt;input type="submit" value="Contact Me"&gt; &lt;/p&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
    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. VO
      singulars
      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