Trigger child link when parent is clicked
I want the <a/> in an <li/> to be triggered when the click happens anywhere within the </li>. So given the html...
- <ul>
- <li><a href="javascript:alert('clicked!')">test</a> <span>some other stuff</span></li>
- <li><a href="javascript:alert('clicked!')">test</a> <span>some other stuff</span></li>
- <li><a href="javascript:alert('clicked!')">test</a> <span>some other stuff</span></li>
- </ul>
...why doesn't this work?
- $(function () {
- $('ul').delegate('li','click', function () {
- $(this).find('a').first().trigger('click');
- });
- });
Instead I get an error...
RangeError: Maximum call stack size exceeded.