Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2013
    Posts
    125
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question adding click function doesn't work?!

    I am trying to make all of the .cornerinner clickable
    here is my code:
    Code:
    <script type="text/javascript">
    	$(".cornerinner").click(function(){
    		alert('hello');
    		window.location.href=$(this).find('a:last').attr('href');
    	});
    </script>
    hello isn't even alerting?!

    Please help

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    ok. are the innercorner elements dynamic in anyway? Are you adding this script block in the head or the bottom of the page?
    are you getting any error?

    side note/tip- when possible you should refer to elements like so li.innercorner , instead of .innercorner, as this means the script is checking every element on the page not just li's or div or whatever the case may be


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •