开发者

How do I set display:inline-block on my addClass()

开发者 https://www.devze.com 2023-02-18 12:02 出处:网络
How do I set my span will be d开发者_JAVA技巧isplay:inline-block $(\"#checking\").fadeTo(200, 0.1, function ()

How do I set my span will be d开发者_JAVA技巧isplay:inline-block

$("#checking").fadeTo(200, 0.1, function ()
 {
  $(this).html('Username is not available').addClass('cross').fadeTo(900, 1);
});

Current output

<span style="display: inline; opacity: 1;" id="checking" class="cross">Username is not available</span>

In CSS I have set the cross class is inline-block.

Let me know how to make the style="display: inline; opacity: 1;" will be style="inline-display: inline; opacity: 1;"


To set the CSS properties of a element, you can just use the css() function:

$('#foo').css('display', 'inline-block');

So in your case, just throw css() into that chain:

$(this).html('Username is not available').addClass('cross').css('display', 'inline-block').fadeTo(900, 1)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号