Tutorial :Is this a valid jquery statement?


Can i apply style like this,

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


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »