哪里是为所有的JavaScript的HTML元素构造的文档? [英] Where is the Documentation for all of the Javascript HTML Element Constructors?
本文介绍了哪里是为所有的JavaScript的HTML元素构造的文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法找到它。谢谢!
例如:
$(#MySelect)追加(新选项(MyOption,MyOption,真实,真实));
解决方案
借助 Mozilla的开发中心一>是的实际的标准文档网站所有的东西的JavaScript。
选项
元素引用:
由于您使用jQuery的,但是,有一个更好的方式来构造元素的。
$('#MySelect')追加(。'<选项>< /选项>,
{
文本:MyOption',
值:'MyOption',
选择:真
})
<子>我不知道最后的真正
参数应该做的事情 - 至少在Chrome中,新选项(文, 价值,真实,真实)
好像又回到同样的事情新选项(文,价值,真)
。
I cannot seem to find it. Thanks!
Example:
$("#MySelect").append(new Option("MyOption", "MyOption", true, true));
解决方案
The Mozilla Dev Center is the de facto standard documentation site for all things JavaScript.
option
element reference:
- HTML
<option
> element HTMLOptionElement
interface (which is implemented by the above)- W3C
HTMLOptionElement
interface spec
Since you're using jQuery, however, there's a better way to construct elements.
$('#MySelect').append('<option></option>',
{
text: 'MyOption',
value: 'MyOption',
selected: true
})
I'm not sure what the last true
argument should do - at least in Chrome, new Option('text', 'value', true, true)
seems to return the same thing as new Option('text', 'value', true)
.
这篇关于哪里是为所有的JavaScript的HTML元素构造的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文