Experimenting with the onclick
event on a parent div led me to realize that making the entire div clickable at 100%
width is not what I intended. I only wanted the sub div to trigger a specific function. Here's an example:
<div id="loginContainer" onclick="link();">
<div id="login_form">
<form method="post">
<input type="text" name="login" value=""/>
<input type="submit" name="submit" value="submit"/>
</form>
</div>
</div>
Check out the demo
Clicking on the form field also triggers the onclick event of the parent div. Is there a way to make the parent div clickable without affecting the sub div using JavaScript, jQuery, or CSS?
Appreciate any help!