使用jQuery添加样式以动态添加元素 [英] Add styles to dynamically added elements with jQuery

查看:152
本文介绍了使用jQuery添加样式以动态添加元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



http:/ / /lufi.realservers.info/demos/add_forms_dynamically/



当我添加另一个元素(输入框)时,我无法删除$ b中的斜体灰色标签$ b不像第一个输入框。另外,如果我点击第一组输入框,它们只会消失。



有没有其他方法可以将样式添加到动态添加的元素?

解决方案

您可以尝试 live() 方法将其应用于动态添加的元素。


heres the demo

http://lufi.realservers.info/demos/add_forms_dynamically/

when i add another element (input boxes) i cannot remove the italicized-grayed labels inside unlike the first input boxes. Also, they only disappear if I click the first set of input boxes.

are there any other ways to add styles to dynamically added elements?

解决方案

You can try the live() method to apply it to dynamically added element.

这篇关于使用jQuery添加样式以动态添加元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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