Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Check if Paragraph is empty

I would like to check if my paragraph tag is empty using Jquery. Meaning without content.

$(function() {
    $("#popupdialog").dialog();
});

HTML

<div id="popupdialog"> 
<p></p> </div>

Separate Instants.

<div id="popupdialog" title="Basic dialog"> 
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>

If the popupdialog is without content. I would like the dialog box to set as autoOpen: false. How should I do it?

like image 354
Gidiyo Avatar asked May 29 '10 06:05

Gidiyo


1 Answers

if ($('#popupdialog > p').is(':empty')) { 
    // we're empty. do stuff.
}
like image 52
x1a4 Avatar answered Nov 01 '22 05:11

x1a4