jquery - prettyCheckboxes make parent div clickable? -


I am using prettyCheckboxes and I want to change it so that the div wrapper also clicked with the radio button Currently there is JS for the radio button / label

  $ label = $ ('label = for' = '' $ (this) .attr ('id') + '"] '); // Add a checkbox holder for label $ label.Prepended ("& lt; span class =' ​​holderWrap '& gt; & lt; span class =' ​​holder '& gt; & lt; / span & gt; Lt; / span & gt;); // If the checkbox is checked, display it as a check ($ (this) .is (': check')) {$ label.addClass ('checked'); }; // Add label labeled label label. AddClass (settings.className) .addClass ($ (this) .attr ('type')). AddClass (settings.display); // Assign the dimensions of the checkbox display $ label.find ('span.holderWrap'). Width (settings.checkboxWidth). Hi (settings.checkboxHeight); . $ Label.find ('span.holder') width (settings.checkboxWidth); // hide the checkbox $ (this) AddClass ('Hidden Checkboxes'); // Click the event $ label. Close ('click', function) {$ ('input #' + $ (this) .attr ('for')). Trigger handler ('click'); If ($ ($ (': checkbox')) ($ (this) .toggleClass ('check'); $ ('input #' + $ (this) .attr ('for')). Checked = true; $ (This) .find ('span.holder'). CSS ('top', 0);} and {$ toCheck = $ ('input #' + $ (for this) .attr ('for')); // Uncheck all radio $ ('input [name =' '$ toCheck.attr (' name ') +' "] ''. Each (function () {$ ('=' '+ $ (This). Label for attr ('id') + '"]' ') RemoveClass (' checked ');}); $ (this) .addClass (' checked '); $ ToCheck.checked = true;};});   

And I want to do this so $. Parent () also calls click function.

Any ideas how can I do this?

Use your own creating a jQuery object: parent:

  var labelAndParent = $ label add ($ (This) .Parent ());   

Then bind to that object:

  labelAndParent.bind ('click', function () {// ...});    

Comments