Reputation: 20223
I have a javascript function which is called from another function I have.
For some reasons, this function is not executed each time when called. I have tryed to change the name of the function, and then everything works fine.
I don't understand why. Here is a litle example:
javascript 1:
function a()
{
b();
}
javascript 2:
function b()
{
c();
}
javascript 3:
function c()
{
alert("Function c");
}
The function c is not executed for some reasons... If for example the function c will be called newC(), then it works fine.
Upvotes: 1
Views: 3088
Reputation: 542
For me it works fine. May be you have some error in the code. IF u post the full code i may able to help. here is the working code
<html>
<head>
<script type="text/javascript">
function a()
{
b();
}
function b()
{
c();
}
function c()
{
alert("hello");
}
</script>
</head>
<body>
<form>
<label>Hello</label>
<button onclick="a()">v</button>
</form>
</body>
</html>
Upvotes: 1
Reputation: 328556
You probably have a conflict of names in the scope of b()
i.e. when b()
is executed, it can happen that c
is defined to something else in a current scope.
Solution: Start your JavaScript debugger, set a breakpoint in b()
and check what c
is at that time.
Upvotes: 5