Calling Jquery function in separate file?
Hi all
I’m sure this is simple but I can’t work it out.
I have an html file that includes jquery and javascript functions file (functions.js) that contains a simple jquery function.
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="robots" content="noindex, nofollow" />
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
Tester('here');
</script>
</head>
<body>
</body>
</html>
functions.js
$(document).ready(function(){
function Tester(name){
alert(name);
}
//Tester('here');
});
The jquery function works if called from the bottom of the function.js file.
How can I call the function from the html page?
I tried with
<script type="text/javascript" charset="utf-8">
Tester('here');
</script>