Reputation: 2215
I am developing a survey page. my HTML code is :
<html>
<head>
<link rel="stylesheet" type="text/css" href="Survey.css" />
<script language="JavaScript" type="text/javascript" src="jquery-2.1.1.min.js"></script>
<script src="Survey.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
My body has one div tag and I am calling one function on its click My js code is:
function showHideSurveyForms(int tab_id)
{
alert("abcd");
}
All the files are in the same folder. but my js is not loaded(jquery loads successfully). why so?
Upvotes: 1
Views: 115
Reputation: 1396
JavaScript is not a statically typed language. So you cant use type declaration in the parameters. Is this what you want? the alert is showing now
function showHideSurveyForms(tab_id)
{
alert("abcd");
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="Survey.css" />
<script language="JavaScript" type="text/javascript" src="jquery-2.1.1.min.js"></script>
<script src="Survey.js" type="text/javascript"></script>
</head>
<body>
<div onclick="showHideSurveyForms(this);">CLICK ME</div>
</body>
</html>
Upvotes: 2