ajax - JQuery : How to acess form elements after load -


i've load form :

$('#content').load('contacts/contact.php #content' ); 

and form html :

<div id="content"> <div class="post">     <h1 class="title">nous contacter</h1>      <div class="entry">          <div id='form_wrap'>              <form method="post" name="contactform" id="contactform">                 <p>hi,</p>                 <label for="sujet">sujet: </label>                 <input type="text" name="sujet" value="" id="sujet" class="validate[required,custom[chaine]] text-input" data-prompt-position="topleft:10"/>                 <label for="message">message : </label>                 <textarea  name="message" value="votre message" id="message" class="validate[required] text-input" data-prompt-position="topleft:20"></textarea>                 <p></p>                  <label for="name">nom: </label>                 <input type="text" name="name" value="" id="name" class="validate[required,custom[chaine]] text-input" data-prompt-position="topleft:10"/>                 <label for="email">email: </label>                 <input type="text" name="email" value="" id="email" class="validate[required,custom[email]] text-input" data-prompt-position="topleft:10"/>                 <input type="submit" name ="env" id ="env" value="envoyer" />             </form>         </div>     </div>   </div> 

i want values of elements in forms after submit, try :

$("#sujet").val() 

but doesn't work !!!

how them (after submit) ?

thank's

try using .get() function:

$.get('contacts/contact.php #content', function(data) {   console.log($(data, "#sujet").val()); }); 

http://api.jquery.com/jquery.get/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -