javascript: problem with function

Posted by Zayatzz on Stack Overflow See other posts from Stack Overflow or by Zayatzz
Published on 2010-04-05T19:06:56Z Indexed on 2010/04/05 19:13 UTC
Read the original article Hit count: 236

Filed under:
|

hi

I have this simple function:

<script type="text/javascript">
//<![CDATA[
    jQuery(function($){
        function here(b){alert(b);} ;
        here(6);
    });
//]]>
</script>

and i have this button on page:

<button onclick="here(7);">TEST</button>

The alert fires on page load, but not on button click. If i replace the here(7) with alert, it works fine. Why doesnt it work with function though?

Alan

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery