开发者

Set htmlFor property for a label tag in mootools or javascript

I want to make a new label in mootools 1.3 by this command:

new Element('lable', {
    'for':'chk_id',
    'html':'hello'
  }).inject(document.body);

the label will creates with 'hello' text but 'for' property dose not apply to the label. I test 'htmlFor' property, i can see this property in firebug but it do开发者_如何学Goes not work (I want to check an input with id='chk_id'). Is there any solution in mootools or javascript?


Perhaps using label rather than the french-sounding lable may be a good place to start. Just make sure the for property matches the id of the input element.

new Element("label[for=bar][text=bar]").inject(document.body);

is fine in 1.3 :) http://jsfiddle.net/Fw9hh/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜