I have one application, which allows users to enter multiple comments into multiple text boxes. Presently I am using the Ck editor tool. I have 4 divs which all are placed in a parent div. We call shift the position of child div up and down and also we can delete the div. When I try to delete the div, it goes and if the user clicks on the add, it should come.
My problem is when I am trying to add the new child div, it will not come under the existing remaining div. I have tried to use Append(), AppendTo(), Insert(), InsertAfter(), etc, but unfortunately with no luck. Can you guys please help me wash out this issue?
Here is one code snippet:
var children = $('#editors').children(); // Editors is a Parent Div.
var childrenCount = children.length;
if (childrenCount == 1) {
if (SectionName == 'Statement') {
$('#p0').insert("#p" + (children[0].id).toString());
Talk1:
it will not come under the existing remaining div, but does it appear nowhere or somewhere else? and why moest childrenCount be 1? more explanation please.
Talk2:
By default the children Count will be 4. If the user delete the divs it comes up to 1. After that User can't delete the remaining one. If the user is trying to add the new div. It should place after the existing child div.
Solutions1
I don't understand exactly what you are trying to achieve, but maybe something like this might help
$("#p0").append($("#p" + (children[0].id).toString()).html());
Solutions2
If I am understanding the issue correctly, you should be able to do something like:
$("
That will append the new div after the one that is still in your parent div.