使用jQuery更改CSS Content属性

时间:2018-02-17 16:25:16

标签: jquery html css

我需要更换"内容"在div里面进行A / B测试。

现在我有了这个HTML:

::before

content:' ';

::after

content:'XXXX% OFF'

在CSS中我有:: before和:: after:

$('.flag off-10- product').attr('content','New XXXX off%');

和jQuery:

function daemonGetNodeStatus(kubeURL, nodeName) {
  console.log(nodeName);
  var request = require("request");
  var options = {
    method: 'GET',
    url: kubeURL+'/api/v1/nodes/'+nodeName+'/status',
    headers: {
      'Cache-Control': 'no-cache',
      'Authorization': 'Bearer '+constants.accessToken
    }
  };

  return new Promise((resolve, reject) => {
    request(options, function(error, response, body) {
      if (error)
        reject(new Error(error));
      var bodyJSON = JSON.parse(body);
      var result = [];
      var temp = {};

      for (var i = 0; i < bodyJSON.status.conditions.length; i++) {
        if(bodyJSON.status.conditions[i].status == "True") {
          result.push(bodyJSON.status.conditions[i].type);
        }
      }

      resolve(result);
  });
}

daemonGetNodeStatus(url, name).then(result => {
   console.log(result);
}).catch(err => {
   console.log(err);
});

0 个答案:

没有答案