以下angularjs代码更改底部边框颜色的正确语法是什么?

时间:2017-03-14 10:32:50

标签: javascript html css angularjs

我想尝试使用这样的东西:

//works fine
angular.element("#startDiscussion")[0].style.border = "1px solid blue";   

以上工作正常。如何仅更改底部?如果我在上面的代码中使用,则border.bottom不起作用。

还需要使灰度滤镜适用于图像。像下面这样的东西?

angular.element("#yellowUnderReview")[0].style.filter.grayscale = "100%";

应该给出如下结果:

img {
-webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */
filter: grayscale(100%);
}

是否有可用于这些的文档?

2 个答案:

答案 0 :(得分:2)

您可以borderBottom尝试border-bottom

angular.element("#startDiscussion")[0].style.borderBottom = "1px solid blue";   

对于filter,您可以使用以下内容:

// Standard syntax
angular.element("#yellowUnderReview")[0].style.filter = "grayscale(100%)";

// Code for Safari 6.0 - 9.0
angular.element("#yellowUnderReview")[0].style.WebkitFilter = "grayscale(100%)";

答案 1 :(得分:0)

最好的方法是使用css:

#startDiscussion {
    border-bottom: 1px solid pink;
}

如果你不能使用css尝试使用驼峰案例风格,这是javascript方式:

borderBottom: 1px solid blue;

也请查看此帖:How to add alpha filter to any HTML element and keep the other filters in IE?

相关问题