htmlコードのdivのinnerHTMLを設定するには:どのようにWebコンポーネントに
<div id="scks" is="select-checkbox" url="data.json" displayName="name" displayValue="value">
</div>
JSコード:
// i want to set html to div(#scks)
// it dose not work
// this is the div(#scks)
select_checkbox_proto.createdCallback = function(){
that.setValue("afterEnd");
}
select_checkbox_proto.setValue = function(val){
this.innerHTML = val;
}
document.registerElement("select-checkbox",{prototype:select_checkbox_proto,extends: 'div'});
をいずれかが私を助けることができますか?
1:これは現在のdiv(#scks)ですか? 2:divに値を設定する方法。
@Supersharpこのdivに初期化値を与え、このdivはページに私たちを表示します。しかし、コードは機能しません。 –
this.innerHTML = this.getAttribute( "displayValue") – Supersharp