I need help in changing opacity of text in textbox.As of now I'm able to change the textbox opacity but I need to change text opacity inside textbox
我需要帮助改变文本框中文本的不透明度。截至目前,我能够更改文本框的不透明度,但我需要更改文本框内的文本不透明度
Here is my code:
这是我的代码:
<script type="text/javascript">
$(document).ready(function () {
//Step 1: set up the slider with some options. The valid values for opacity are 0 to 1
//Step 2: Bind an event so when you slide the slider and stop, the following function gets called
$('#slider').slider({ min: 0, max: 1, step: 0.1, value: 1 })
.bind("slidechange", function () {
//get the value of the slider with this call
var o = $(this).slider('value');
//here I am just specifying the element to change with a "made up" attribute (but don't worry, this is in the HTML specs and supported by all browsers).
var e = '#' + $(this).attr('data-wjs-element');
$(e).css('opacity', o)
});
});
</script>
And this is my textbox
这是我的文本框
<div id="slider" data-wjs-element="TextBox1"></div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
2 个解决方案
#1
1
You may use rgba for color but IE8 and below doesn't support it. Also some older versions of other browsers doesn't support. You can find information from here.
您可以使用rgba作为颜色,但IE8及以下版本不支持它。另外一些旧版本的其他浏览器也不支持。您可以从这里找到信息。
$(e).css('color', 'rgba(255, 255, 255, ' + o + ')');
BTW your "made up" attribute is part of HTML5 :) You can access it's value like this;
顺便说一句,你的“组成”属性是HTML5的一部分:)你可以像这样访问它的价值;
$(this).data('wjs-element');
#2
0
Did you tried with:
你尝试过:
$(e).fadeTo(0, o);
?
?
#1
1
You may use rgba for color but IE8 and below doesn't support it. Also some older versions of other browsers doesn't support. You can find information from here.
您可以使用rgba作为颜色,但IE8及以下版本不支持它。另外一些旧版本的其他浏览器也不支持。您可以从这里找到信息。
$(e).css('color', 'rgba(255, 255, 255, ' + o + ')');
BTW your "made up" attribute is part of HTML5 :) You can access it's value like this;
顺便说一句,你的“组成”属性是HTML5的一部分:)你可以像这样访问它的价值;
$(this).data('wjs-element');
#2
0
Did you tried with:
你尝试过:
$(e).fadeTo(0, o);
?
?