简体   繁体   English

无法弄清楚为什么我的Javascript没有使用Bulma框架更改CSS

[英]Can't figure out why my css isn't being changed by my Javascript using Bulma framework

I am new to css and Bulma. 我是CSS和Bulma的新手。

This is the relevant code for my problem. 这是我的问题的相关代码。

for (var i=0; i<20; i++){

  if (i<list.length){

    var textTemplate="{{text}}";
    attach= Mustache.render(textTemplate,list[i]);
    attach=document.createTextNode(attach);
    var basePlate=document.createElement("section");

    basePlate.style.class="section";

    var listPiece=document.createElement("dt");

    listPiece.style.class="container";

    toInsert.appendChild(basePlate);

    basePlate.appendChild(listPiece);

    listPiece.appendChild(attach);
    ....

The class changes to basePlate and listPiece isn't changing anything on the actual web page, and I have no idea why. 该类更改为basePlate和listPiece并没有更改实际网页上的任何内容,我也不知道为什么。 Can anyone explain? 谁能解释?

Because inside object style are css properties such background-color , width , opacity , display , etc 因为内部对象style是css属性,例如background-colorwidthopacitydisplay

use: 采用:
listPiece.className="container";

reference: https://developer.mozilla.org/en-US/docs/Web/API/Element/className 参考: https : //developer.mozilla.org/zh-CN/docs/Web/API/Element/className

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法弄清楚为什么我的JavaScript没有做任何事情 - Can't figure out why my javascript isn't doing anything 似乎无法弄清楚为什么我的JavaScript无法在IE和Chrome中运行 - Can't seem to figure out why my javascript isn't working in IE and Chrome 无法弄清楚为什么javascript无法在我的php文件中工作 - Can't figure out why javascript isn't working in my php file 无法弄清楚为什么javascript不存储我的变量 - Can't figure out why javascript isn't storing my variable 我无法弄清楚为什么 javascript 生成的元素没有被我的样式表设置样式 - I can't figure out why the javascript generated <tr> elements aren't being styled by my stylesheet 我不知道为什么我的JavaScript无法正常工作…我正在将值动态传递给标签 - I can't figure out why my javascript isn't working… I'm dynamically passing values to a tag 试图在 Javascript 中创建一个“trie”。 无法弄清楚为什么我的方法没有正确添加孩子 - Trying to create a 'trie' in Javascript. Can't figure out why my method isn't adding the children correctly 有人可以帮我解决为什么我的 javascript 对象没有被创建吗? - Can someone help me out with why my object in javascript isn't being created? 无法弄清楚为什么我的文字没有变成绿色 - Can't figure out why my text isn't turning into green 无法弄清楚为什么我的change(...)事件处理程序在这种情况下不起作用 - Can't figure out why my change(…) event handler isn't working in this scenario
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM