jquery empty selector


  Translation results:

empty

English [ˈempti] American [ˈɛmpti]

adj. Empty, empty, empty; idle, ineffective, futile; Boring, stupid; empty words or actions

vt. (to make) empty, to empty out; to free up...

vi.Become empty; flow empty

n. Empty car; empty thing

jquery empty selectorsyntax

Function: :empty selector selects empty elements. An empty element is an element that contains no child elements or text.

Syntax: $(":empty")

jquery empty selectorexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript"> 
 
$(document).ready(function(){
    $(":empty").css("background-color","#B2E0FF");
});
 
</script>	
 
</head>
<body>
<html>
<body>
<h1>Welcome to My Web Page</h1>

<table>
<tr>
<th>Id</th>
<th>LastName</th>
<th>FirstName</th>
<th>Address</th>
<th>City</th>
</tr>
<tr>
<td>1</td>
<td></td>
<td>John</td>
<td>Oxford Street</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Bush</td>
<td>George</td>
<td></td>
<td>New York</td>
</tr>
<tr>
<td>3</td>
<td>Carter</td>
<td>Thomas</td>
<td>Changan Street</td>
<td>Beijing</td>
</tr>
<tr>
<td>4</td>
<td>Obama</td>
<td></td>
<td>Pennsylvania Avenue</td>
<td>Washington</td>
</tr>
</table>
</body>
</html> 
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A