$(function(){
function f1(){}
function f2(){}
}
<Input type = radio Name = radiobutton Value = "something" checked=checked onClick= //here call f1()//>
I try to get access to f1 function in OnClick
code like this doesn’t work:
$.function.f1()
$.function().f1()
That’s because you should be doing it something like this:
… instead of putting an
onclick=attribute on your HTML markup.EDIT
As requested, some quick notes on why you should do the jQuery bind instead of the
onclickmarkup thing.onclick=do_backflips()in your HTML markup violates that, and will lead to nightmarish maintenance issues in the future, among other things.onclick=syntax is inherently1:1. Which means that naturally, for each event of each element, you only get to attach one single event handler. That definitely sucks balls.f1andf2functions inside thedocument.readyhandler function, you’re limiting their scope within that function. This means that they can’t be referenced outside that scope, which means that the script interpreter won’t know aboutf1where your HTML markup is. You have to attach event handlers where the handlers are known, and that’s insidedocument.ready(if that makes sense).