gpt4 book ai didi

php - 如何在jquery中改变字体颜色

转载 作者:太空宇宙 更新时间:2023-11-04 10:47:16 25 4
gpt4 key购买 nike

我想改变html的字体颜色(用户名+'已经存在,请换一个');但我不知道如何更改它。

function check_availability(){  

//get the username
var username = $('#username').val();

//use ajax to run the check
$.post("<?php echo base_url();?>loginFunction/checkUsername", { username: username },
function(result){
//if the result is 1
if(result == 1){
//show that the username is available
$('#username_availability_result').html(username + ' is Available');
}else{
//show that the username is NOT available
$('#username_availability_result').html(username + ' is already exist. Please try another one');
}
});

最佳答案

尝试使用 css -

$('#username_availability_result')
.css('color', 'red')
.html(username + ' is already exist. Please try another one');

关于php - 如何在jquery中改变字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35291796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com