我有以下代码段:
<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');
});
请在这里帮助我。
答案 0 :(得分:0)
Pass the text field event to this.
jQuery(document).ready(function($){
$('.clickable').on("click", function(){
$(this).find('.glyphicon').css("color", "#FFF000");
});
});
答案 1 :(得分:0)
您必须更改量程颜色
$(document).on("change", "#newTagText", function (e) {
$("#addNewTagButton span").css("color", "#0000FF");
});
答案 2 :(得分:0)
最后,我可以这样做:“改变”,而不是“改变”,“keyup”工作!
$(document).on("keyup", "#newTagText", function (e) {
$(".glyphicon-floppy-disk").css("color", "#0000FF");
$(".glyphicon-remove-circle").css("color", "#0000FF");
});
答案 3 :(得分:0)
$("#newTagText").on('change', function () {
$('#addNewTagButton').css('color', '#0000FF !important');
});