插入一个表格到页面重新初始化的jQuery移动后, [英] Reinitialize jquery-mobile after inserting a form into the page

查看:121
本文介绍了插入一个表格到页面重新初始化的jQuery移动后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过AJAX动态插入一个表格到页面。将其插入到DOM树后,我想重新初始化jQuery Mobile的样式表单。我进去一看 http://jquerymobile.com/test/docs/api/events。 HTML 但由于文档是pretty的无助于jQuery Mobile的,我无法找到正确的事件。

I'm inserting a form via ajax dynamically into the page. After inserting it into the dom tree, i would like to reinitialize the jquery mobile to style the form. I had a look into http://jquerymobile.com/test/docs/api/events.html but since the documentation is pretty unhelpful for jquery mobile I'm not able to find the correct event.

推荐答案

在您添加的形式向DOM,使用 .trigger('创建'); 上形式初始化任何小部件(表单元素)你刚才又说:

After you have added the form to the DOM, use .trigger('create'); on the form to initialize any widgets (form elements) you've just added:

...html('<form><input data-role="slider" type="text" /><input type="button" value="button" /></form>').trigger('create');

下面是一个演示: http://jsfiddle.net/TBRXk/

这篇关于插入一个表格到页面重新初始化的jQuery移动后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆