Move (Copy) Div From One Place To Another Using jQuery

Hello Friends if you want to copy or move the data from one div to onther div you can do it easily with jquery.I can do it by creating new HTML and append it to Active records list. But i came to know about Clone functionality of jQuery, Which is best thing to move or copy any html element.

here are two possibility in Clone function of jQuery. If you want to keep the Div at their place and create the same Div at some other place than you can go for Clone. If you want to Move the Div from one place to another than use appendTo. Look at below syntax.

$(“div#source_div_id”).appendTo(“div#destination_div_id”);

Advertisements

Find Number of Child Elements (Length) Using jQuery

Hi Friends, Some days ago I was working on one task in which I was trying to find number of child elements by id or class of parent element by jQuery. I searched about it and found solution for it, So I thought it is worth to share on my wesbite for users, So it can be helpful for anyone and save time for someone.

So below I am going to show to show you can find number of child elements using jQuery.

$(“div#parent_div”).children().length

So by above code you can find number of child elements by id of parent element. In above code id of parent element is “parent_div” , So if you will use this code you will get number of child elements inside this parent.

So by above code you can find number of child elements by id of parent element. In above code id of parent element is “parent_div” , So if you will use this code you will get number of child elements inside this parent