任何用css样式动态添加输入元素到html页面的方法? [英] any method to dynamically add a input element with css styles to a html page?

查看:316
本文介绍了任何用css样式动态添加输入元素到html页面的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在按钮点击时动态添加一个单选按钮和一个文本字段及其对应的css。我发现很多方法动态添加元素但css不起作用。请建议一些链接

I want to add a radio button and a text field dynamically with their corresponding css when a button clicks. I do find many methods to add elements dynamically but the css is not working. please suggest some links

推荐答案

请参阅我对该问题的评论。很明显,没有问题的描述=>没有答案。



但是,我可以给你一个建议:你对HTML DOM元素的操作越简单,错误的可能性就越小。为了大大简化它,您可以使用jQuery。请参阅Manipulation类别中的jQuery方法:

http://api.jquery.com/category/操纵/ [ ^ ],

http://api.jquery.com/category/manipulation/dom-insertion-around / [ ^ ] ,

http://api.jquery.com/category/manipulation/ dom-insertion-inside / [ ^ ],

http://api.jquery.com / category / manipulation / dom-insertion-outside / [ ^ ]。



如果您需要学习jQuery(强烈推荐),请参阅:

http://en.wikipedia。 org / wiki / JQuery [ ^ ],

http://jquery.com/ [ ^ ],

http://learn.jquery。 com / [ ^ ],

http://learn.jquery.com/using-jquery-core/ [ ^ ],

http://learn.jquery.com/about-jquery/how-jquery-works/ [ ^ ](从这里开始) 。



祝你好运,

-SA
Please see my comment to the question. Quite apparently, no description of the problem => no answer.

However, I can give you an advice: the simpler your manipulations on the HTML DOM elements, the less likely the bugs. To simplify it greatly, you can use jQuery. Please see the jQuery methods in Manipulation category:
http://api.jquery.com/category/manipulation/[^],
http://api.jquery.com/category/manipulation/dom-insertion-around/[^],
http://api.jquery.com/category/manipulation/dom-insertion-inside/[^],
http://api.jquery.com/category/manipulation/dom-insertion-outside/[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^],
http://learn.jquery.com/[^],
http://learn.jquery.com/using-jquery-core/[^],
http://learn.jquery.com/about-jquery/how-jquery-works/[^] (start from here).

Good luck,
—SA


这篇关于任何用css样式动态添加输入元素到html页面的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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