How to get form id on load jquery page

How to get form id using jQuery on page load.

I have a form on the page. I need to get this form id using jQuery.

How can i do this.

thanks in advance...

+4
source share
3 answers

to try

$(document).ready(function(){ alert($('form').attr('id')); }); 
+3
source
 $(document).ready(function(){ var formId = $('form').attr('id'); }); 
+5
source
 $(document).ready(function(){ $('form').each(function(){ alert($(this).attr('id')); // or simple this.id }) }) 
+2
source

All Articles