tags:

views:

41

answers:

3

Can i apply style like this,

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

EDIT:

i am trying to use jquery facebox in asp.net.. i am having issues with the close button.. http://stackoverflow.com/questions/3346172/hide-jquery-facebox-modal-manually

A: 

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

$('#facebox .content').hide();
Munzilla
+3  A: 

.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).

meder
@meder i am trying to use jquery facebox in asp.net.. i am having issues with the close button.. http://stackoverflow.com/questions/3346172/hide-jquery-facebox-modal-manually
Pandiya Chendur
A: 

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.

Felix Kling