Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to bind click event to checkbox label
    text
    copied!<p>I'm hoping a javascript / jquery guru can help me out.</p> <p>I'm trying to figure out a way to launch a popup box (fancybox) from the click of a checkbox label. I don't want to effect the checkbox function which filters data when clicked.</p> <p>I would welcome any thoughts on how I can make this happen. I've tried an onclick function on the label but that doesn't work.</p> <p>I want to show a fancybox when you click on a persons name in the checkbox label. Here's the site:- (example: jonathanlyon)</p> <p><a href="http://monkeygetnews.jonathanlyon.com/bs.php" rel="nofollow">http://monkeygetnews.jonathanlyon.com/bs.php</a></p> <p>The checkboxes are built dynamically and I need to create a click event on the label that opens a fancybox. Here's the code to build the checkboxes:-</p> <pre><code>&lt;input type="checkbox" id = "dn" value="dept_&lt;?php echo $currdept;?&gt;" onchange="doSearch();return false;" /&gt; &lt;label&gt;&lt;?php echo $currdept;?&gt;&lt;/label&gt; &lt;ul class="dept_&lt;?php echo $currdept;?&gt;"&gt; &lt;li&gt; &lt;input type="checkbox" name = "un" value="&lt;?php echo $usernames;?&gt;" &lt;?php echo $include;?&gt; onchange="doSearch();return false;" /&gt; &lt;label&gt;&lt;?php echo $usernames;?&gt;&lt;/label&gt; &lt;/li&gt; &lt;?php $dept = $currdept; } else { ?&gt; &lt;li&gt; &lt;input type="checkbox" name = "un" value="&lt;?php echo $usernames;?&gt;" &lt;?php echo $include;?&gt; onchange="doSearch();return false;" /&gt; &lt;label&gt;&lt;?php echo $usernames;?&gt;&lt;/label&gt; &lt;/li&gt; &lt;?php $dept = $currdept; } ?&gt; </code></pre> <p>Thanks </p> <p>Jonathan</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload