这个让我难过.我想从label元素中删除"+" .这是HTML:
<label class="option" for="edit-attributes-21-33">
<input type="radio" id="edit-attributes-21-33" name="attributes[21]"
value="33" checked="checked" class="form-radio"> 4 oz, +$15.00</label>
Run Code Online (Sandbox Code Playgroud)
我从这开始
$(".option").each(function(index, value) {
$(this).text( $(this).text().replace("+", ""));
})
Run Code Online (Sandbox Code Playgroud)
这将删除"+",但也会删除输入元素.那么我试过:
$(".option").each(function(index, value) {
var oldString = $(this).html();
var newString = oldString.replace("+", "");
console.log(oldString, newString);
$(this).text(newString);
})
Run Code Online (Sandbox Code Playgroud)
这会产生一个正确的html标记字符串,但它是一个字符串,并以这种方式传回DOM.我看到另一篇帖子有同样的问题,但没有解决方案.
我有一个类需要一些坐标和持续时间数据。我想用它来为svg. 更明确地说,我想使用该数据svg在时间范围内更改属性。
我在课外使用一个step函数requestAnimationFrame:
function step(timestamp) {
if (!start) start = timestamp
var progress = timestamp - start;
var currentX = parseInt(document.querySelector('#start').getAttribute('cx'));
var moveX = distancePerFrame(circleMove.totalFrames(), circleMove.xLine);
document.querySelector('#start').setAttribute('cx', currentX + moveX);
if (progress < circleMove.duration) {
window.requestAnimationFrame(step);
}
}
var circleMove = new SingleLineAnimation(3000, startXY, endXY)
var start = null
function runProgram() {
window.requestAnimationFrame(step);
}
Run Code Online (Sandbox Code Playgroud)
我可以把它的方法,取代了circleLine用this。这对于第一次运行很好,但是当它this.step第二次调用回调时,好吧,我们处于回调黑洞中,并且对 的引用this被破坏了。做旧的self = this也行不通,一旦我们进入回调this是未定义的(我不知道为什么)。这是一种方法:
step(timestamp) { …Run Code Online (Sandbox Code Playgroud) 我正在努力解决postgres客户端安装上的错误。我正在持续集成版本上安装此程序,因此我需要安装它而不会出现错误。关键是,客户端已经安装,psql如果我ssh进入服务器,我什至可以运行命令,但是我需要在不接触的情况下运行它,这意味着安装必须正确无误。我已经完成了所有的google-foo,并且没有在Ubuntu论坛上看到过任何建议,或者这里似乎没有指出正确的方向。这一切都在Ubuntu 14.04上。
或者,只要客户端可用,我也许可以使错误保持沉默。
以下是我遇到的错误:
须藤apt-get install postgresql-client
正在阅读包装清单...完成
建立依赖树
正在读取状态信息...完成
将安装以下附加软件包:
libpq5 postgresql-client-9.6 postgresql-client-common
建议包装:
PostgreSQL的9.6 PostgreSQL的文档的9.6
将安装以下新软件包:
libpq5 postgresql客户端postgresql客户端9.6 postgresql客户端常见
0个已升级,4个新安装,0个要删除和7个未升级。
需要获取1494 kB档案。
执行此操作后,将使用6121 kB的额外磁盘空间。
获取:1 http://deb.debian.org/debian Stretch / main amd64 libpq5 amd64 9.6.7-0 + deb9u1 [132 kB]
Get:2 http://deb.debian.org/debian Stretch / main amd64 postgresql-client-common全部181 + deb9u1 [79.0 kB]
获取:3 http://deb.debian.org/debian Stretch / main amd64 postgresql-client-9.6 amd64 9.6.7-0 + deb9u1 [1228 kB]
获取:4 http://deb.debian.org/debian Stretch / main amd64 postgresql-client全部9.6 + 181 + deb9u1 [55.7 kB] … 我们提供了许多颜色与特定的悬停状态颜色相关联:
$red: #cb333b;
$red-hover: #fe666e;
$brown: #544742;
$brown-hover: #877a75;
etc.
Run Code Online (Sandbox Code Playgroud)
由于所有颜色都以相同的方式格式化,所以我希望编写一个带有颜色变量名称的mixin,然后连接-hover到结尾.这是我的第一次尝试:
@mixin button_colorizor($color) {
border-color: $color;
color: $color;
&:hover {
color: #{$color}-hover;
border-color: #{$color}-hover;
}
}
Run Code Online (Sandbox Code Playgroud)
但这样做的是输出这样的颜色:#f1735f-hover.当我这样做时:color: #{$color+-hover};
我正试图将一个字典附加到列表中.我在网站上已经看过几次这个问题,但是使用.copy()提出的解决方案似乎没有解决问题.我是否还需要循环我的附加变量?
for page in pages :
if 'http' in page :
machineList = []
machine = getPinballMachine(page, siteURL) # this function returns a dict(ionary) of elements from a webpage
machineList.append(machine.copy())
print (machineList)
Run Code Online (Sandbox Code Playgroud)
只打印最终字典.
javascript ×2
animation ×1
debian ×1
dictionary ×1
html ×1
jquery ×1
loops ×1
mixins ×1
oop ×1
postgresql ×1
python ×1
sass ×1
scope ×1
string ×1
ubuntu ×1