Home > JavaScript, jquery > Number of Child elements (length) using jQuery

Number of Child elements (length) using jQuery

Hello Friends,

Here i am showing you the way to get the number of child elements for parent div. This may be helpful to you when you are show/delete records using jQuery-Ajax and want to update the page accordingly. For e.g. This counting of Children elements helps you to show message like no records when you delete last record. Look at below syntax.

 $(“div#parent_div”).children().length
If you find any problem in this than let me know by comment.
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: