开发者

Is this a valid jquery statement?

Can i apply style like this,

$('#aspnetForm').append($('#facebox .content').html().css({ 'display': 'none' })); but it didnt wor开发者_StackOverflow中文版k...

EDIT:

i am trying to use jquery facebox in asp.net.. i am having issues with the close button.. hide jquery facebox modal manually


.html() returns a string. It doesn't have a css method. You can wrap the html in another element, hide it, then append it for fine-grained control:

var html = $('<div/>').html( $('p:first').html() ).css({'display':'none'}).appendTo('body')

You can also manipulate it directly by calling .css first, on the element(s).


What are you trying to do that you can't accomplish by using .hide()?

$('#facebox .content').hide();


html() returns a string so you cannot apply a jQuery method on it. Switch the methods:

$('#aspnetForm').append($('#facebox .content').css({ 'display': 'none' }).html());

Of course you have to be carful with elements inside '#facebox .content' that have an ID. An ID has to be unique throughout the page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜