last day (26 days later) » 

8:13 PM
hi man
howz u
 
room topic changed to Bind independent events to the dynamic added elements: stackoverflow.com/questions/26515247 [jquery]
 
howz u
man
 
Good. How r u? How can I be of help?
 
yes i need urs little favor
$("#data").on('click', '.AddCol', function () {

var count = 0;
debugger;
// alert("hi");
$(this).click(function () {
count++;
if (count < 5) {
alert(count);
$("<div class='well droppedFields ui-sortable Resizable'></div>").appendTo("#Section1");

}
else {
alert('No more divs to add')
}
// addClick(count);
});

});
this code is appending the "<div class='well droppedFields ui-sortable Resizable'></div> " to the section that are added dynamically
 
Ok. What is this supposed to do?
 
8:16 PM
.
 
Here is how I would write this piece of code:
var count = 0;
debugger;
$("#data").on('click', '.AddCol', function () {
count++;
if (count < 5) {
alert(count);
$("<div class='well droppedFields ui-sortable Resizable'></div>").appendTo("#Section1");

}
else {
alert('No more divs to add')
}
// addClick(count);

});
Are you there?
 
yes
sorry intrnt was down
 
ok.
 
i am trying with ur code
 
Take your time.
 
8:33 PM
yes
it is adding to the div
to the section1
means
i am telling you the entire process and the problm?
are u around @PeterKA
 
Where do you want it to append to?
Let's scratch everything. What do you want to do when a button is clicked?
 
my add section button code

...............................................
$("#AddSec").click(function() {

$("<div />", {
"class": "wrapper"
})
.append($('<span />', {
"class": "AddCol",
id: "AddCol" + i
}).html('(+)col'))
.append($('<span />', {
"class": "RemCol",
id: "RemCol" + i
}).html('(-)col'))
.appendTo("#data");
$("<div />", {
"class": "SecStyle",
id: "Section" + i
})
.append($("<div/>").attr('class', 'well droppedFields ui-sortable Resizable'))
.appendTo("#data");
i++;
});
..................................................................
this will apend the divs inside my data div that is static
got it ???\
 
I do not think I understand your question, if any?
Do you have a specific question or problem with existing code?
 
above code is nothing just appending the divs inside my static data div
i am showing u the html elements
if i click the above button code two times
.....................................................................
<div id="data" style="height: 100px; line-height: 20px; width: 100%; display: table;">
<div class="wrapper">
<span class="AddCol" id="AddCol1">(+)col</span>
<span class="RemCol" id="RemCol1">(-)col</span>
</div>
<div class="SecStyle" id="Section1">
<div class="well droppedFields ui-sortable Resizable ui-resizable ui-droppable">
<div class="ui-resizable-handle ui-resizable-e" style="z-index: 90; display: block;">
</div>
</div>
</div>
<div class="wrapper"><span class="AddCol" id="AddCol2">(+)col</span>
you can see the code here that is append to my #data div
see this image
you will get it
 
I think if you create a jsfiddle we would communicate more effectively.
 
8:46 PM
yes
make sense
do not go please b there
hi @PeterKA
this is jsfidle
now i want to acheive the click events for (+)col (-)col
 
will take a look momentarily
 
ok bro
for each section independently
 
9:03 PM
makes perfect sense now.
Give me a sec.
 
ohk
ji
are getting my point now ?
u around ? @PeterKA
 
yes, I am here.
 
great'
have u tak a look on fiddle ?
 
Take a look at this: jsfiddle.net/tdorbbv6/28
This is better: jsfiddle.net/tdorbbv6/31
I added a data-target attribute to all your buttons so each button can add or remove from the right section.
In the .AddCol you should see how easy it is to retrieve this value and use it.
For for the count variable add a data-count attribute to each section and set it to "0" initially.
At each click you can read this value and increment or decrease it and put it back.
Let me know.
I got to go now.
 
9:21 PM
wait please
a lill
it will give alert undefined
 
If my answer was helpful be sure to upvote and accept it.
 
yes i will surely , coz u r pulling me up from the stucked situation
@PeterKA
are u around
litle more favor needed
 
What's up?
 
the alert says undefined in my code
you add
var targetSection = $(this).data('#section');
this
and
$("<div class='well droppedFields ui-sortable Resizable'></div>").appendTo(targetSection);
this corect ??
 
I do not have $(this).data('#section') anywhere in my code. Please take a look at this: jsfiddle.net/tdorbbv6/32
$(this).data('target');
the second one is correct.
 
9:28 PM
yipee done
 
With the comments I have provided, I am confident you will more than figure out the rest. You'll be just fine. Ciao!
 
u r my hero
 
take care!!
 
but it is adding only
5 divs
means 5 columns
i need to add 5 columns to each section
:(
last favor please
 

  last day (26 days later) »