user1260310
user1260310

Reputation: 2227

JS function as simple as it gets, hyperlink syntax

Can someone explain why, in this example, the function is not firing? I've stripped it down to the simplest thing and I must have typo or wrong syntax for hyperlink.

JS

function takePic(type){
    alert(type);
}

HTML

<a href="javascript:void(0)" onclick="takePic('1');">Track Progress</a>

Upvotes: 0

Views: 106

Answers (1)

Musa
Musa

Reputation: 97717

Change onLoad to no wrap (head) in the "choose framework" dropdown. With onLoad, the function is wrapped in another function and does not have global scope.

http://jsfiddle.net/smkqW/3/

Upvotes: 3

Related Questions