WordPress.org

Ready to get started?Download WordPress

Forums

javascripts:Uncaught ReferenceError: function is not defined (1 post)

  1. wdisk
    Member
    Posted 2 years ago #

    b.js call function defined in a.js, but get "Uncaught ReferenceError: function a is not defined"
    Thanks in advance!

    index.htm

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type='text/javascript' src='jquery.js'></script>
    <script type='text/javascript' src='a.js'></script>
    <script type='text/javascript' src='b.js'></script>
    </head>
    <body>
    <a href="#" class="text">1234</a>
    </body>
    </html>

    a.js

    jQuery(document).ready(function($) {
    	function a()
    	{
    		alert(123);
    	}
    })

    b.js

    jQuery(document).ready(function($) {
    	$('.text').click(function(e){
    		a();
    		e.preventDefault();
    	})
    })

Topic Closed

This topic has been closed to new replies.

About this Topic