javascript - 在 Jquery 中更改文本更改字形颜色

标签 javascript jquery html css twitter-bootstrap

我有以下代码片段:

<div class="col-xs-6">
    @Html.TextBoxFor(model => model.TagName, new {@class = "textBoxTextFormat", @id = "newTagText"})
</div>
<div class="col-xs-3" >
    <a href="#" id="addNewTagButton"><span class="glyphicon glyphicon-floppy-disk" style="color: #4790b8; vertical-align: bottom; margin-top: 5px; font-size: 30px;"></span></a>
    <a href="#" id="cancelNewTagButton"><span class="glyphicon glyphicon-remove-circle" style="color: #4790b8; vertical-align: bottom; margin-top: 5px; font-size: 30px;"></span></a>
</div>

产生以下输出: ScreenShot

我想让保存和取消按钮在文本框中的文本更改时变暗。我尝试了以下但它不起作用:

$(document).on('change', '#newTagText', function (e) {
    $('#addNewTagButton').css('color', '#0000FF');
});

请帮帮我。

最佳答案

Pass the text field event to this.

jQuery(document).ready(function($){
$('.clickable').on("click", function(){
    $(this).find('.glyphicon').css("color", "#FFF000");
});
});

Demo Here

关于javascript - 在 Jquery 中更改文本更改字形颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38527210/

相关文章:

javascript - Vue - 带有子输入组件的表单组件

javascript - 在 Ember 中指定路由的默认值

jquery - CSS 阻止折叠我的 DIV

jquery - 如何使用 JQuery 选择具有多个表单的页面上的单个文本元素

javascript - 加载 jquery-migrate.min.js 时如何摆脱错误 "Unsupported format of the sourcemap"?

javascript - 如何在创建用户之前验证电子邮件?

jquery - iPhone:jQuery scroll() 事件仅在发布时触发

html - 根据窗口大小调整字体大小

javascript - 页面加载时背景颜色变化

html - 更改 Bootstrap 导航栏的大小