简体   繁体   中英

Jquery Mobile - How do I get the form element of the active Page without using the form id

I need to get the form element of the active page without using the form id. Basically I'm dealing with dynamic external content and can't rely on the form id as it may change. Also, it's possible that there may not be a form on the page.

$.mobile.activePage .?

Try:

$.mobile.activePage.find("form")

or

$("form", $.mobile.activePage)

Well if there is only one form element on the page, you can do a

$.mobile.activePage.find("form")

If there are more than one form elements, obviously this will return an array object containing the forms, then you'll just need to filter, or just make the above js call more specific.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM