I have a function:
var oneWay = function (){
$(".one-way").show();
$(".round-trip").hide();
$(".multi-stop").hide();
};
I want to trigger this function on an action, i.e.:
$(document).ready(function(){
$("input:radio[value=one-way]").click('oneWay');
});
But this isn’t working. I think my syntax might be off.
Also, what if I wanted to just execute this function when the DOM is ready? Would it be this:
$(document).ready(function(){
oneWay;
});
Thanks,
Brian
Exactly what DavidGouge said. Further, to answer your other question, you just do this:
Remember that
oneWayis a reference to a function (passed as an “object”), whileoneWay()executes that function immediately.