开发者

How to get the form id on page load jquery

How 开发者_StackOverflow中文版to get form id using JQuery on page load.

I am having a form in a page. I need to get that form's id using JQuery .

How can I do that..

thanks in advance...


$(document).ready(function(){
    var formId = $('form').attr('id');
});


try

$(document).ready(function(){
    alert($('form').attr('id'));
});


$(document).ready(function(){
    $('form').each(function(){
        alert($(this).attr('id')); // or simple this.id
    })
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜