我有以下代码片段:
<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中更改文本时更改glyphicon颜色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38527210/