I am trying to get form from jQuery, and could not find a solution. I have tried some examples but they don't show me the form tags and its attributes.
I have three forms on my page and I wants to take the second form .WHen i use this code it shows me the first form data.Can you please tell me the solutions for getting second form on my page and also the form element.
I want to get this form from jQuery, and I have used this code but this code gives me the element from form not the form tag .
$(document).ready(function()
{
$('a').on('click', function() {
alert($('form').html());
});
});
The Form is
<form class="variations_form cart" method="post" enctype="multipart/form-data" data-product_id="1142" data-product_variations="[{"variation_id":"1153","attributes":[],"image_src":"http:\/\/maza-it.net\/tilde\/wp-content\/uploads\/2013\/10\/H07-300x300.jpg","image_link":"http:\/\/maza-it.net\/tilde\/wp-content\/uploads\/2013\/10\/H07.jpg","image_title":"H07","image_alt":"","price_html":"<span class=\"price\"><span class=\"amount\">$26<\/span><\/span>","availability_html":"<p class=\"stock \">19 in stock<\/p>","sku":"555","weight":" kg","dimensions":"","min_qty":1,"max_qty":"19","backorders_allowed":false,"is_in_stock":true,"is_downloadable":false,"is_virtual":false,"is_sold_individually":"no","image_magnifier":"http:\/\/maza-it.net\/tilde\/wp-content\/uploads\/2013\/10\/H07-600x600.jpg"},{"variation_id":"1154","attributes":[],"image_src":"http:\/\/maza-it.net\/tilde\/wp-content\/uploads\/2013\/10\/S05-300x300.jpg","image_link":"http:\/\/maza-it.net\/tilde\/wp-content\/uploads\/2013\/10\/S05.jpg","image_title":"S05","image_alt":"","price_html":"<span class=\"price\"><span class=\"amount\">$100<\/span><\/span>","availability_html":"<p class=\"stock \">9 in stock<\/p>","sku":"60","weight":" kg","dimensions":"","min_qty":1,"max_qty":"9","backorders_allowed":false,"is_in_stock":true,"is_downloadable":false,"is_virtual":false,"is_sold_individually":"no","image_magnifier":"http:\/\/maza-it.net\/tilde\/wp-content\/uploads\/2013\/10\/S05-600x600.jpg"}]">
<table class="variations" cellspacing="0">
<tbody>
</tbody>
</table>
<div class="single_variation_wrap" style="display:none;">
<div class="single_variation"></div>
<div class="variations_button">
<input type="hidden" name="variation_id" value="">
<div class="quantity buttons_added" style="display: none;"><input type="button" value="-" class="minus"><input type="number" step="1" name="quantity" value="1" title="Qty" class="input-text qty text"><input type="button" value="+" class="plus"></div>
<button type="submit" class="single_add_to_cart_button button alt">Select Product</button>
</div>
</div>
<div>
<input type="hidden" name="add-to-cart" value="1142">
<input type="hidden" name="product_id" value="1142">
</div>
</form>