Friday, 15 July 2011

jquery - How to distinguish from which div event is generated -



jquery - How to distinguish from which div event is generated -

on click of checkbox , copying same section of html div named "ordersdiv"

now user can click on both checkboxes activateuihtml div or ordersdiv div

right have mutual listener both of them shown

$(document).on("click", ".checkboxclas", function(e) { var divdata = $("div.activateuihtml").html(); $("#ordersdiv").append(divdata); });

this jsfiddle

http://jsfiddle.net/e56ty/18/

just add together class orders div

<div id="ordersdiv" class="orders">

try this

$(document).on("click", ".checkboxclas", function(e) { var cls = $(this).parents('div').attr('class') // based on class if(cls == 'activateuihtml') { var divdata = $("div.activateuihtml").html(); $("#ordersdiv").append(divdata); } else{} });

demo

jquery

No comments:

Post a Comment