I have a .js file with the following function
function set_priceKind_global(priceKind)
{
switch(priceKind)
{
case “paid”:
case “free”:
break;
default:
var throw_msg = “Internal confusion in set_priceKind_global”
alert(throw_msg)
throw throw_msg
}
It is triggered by
%input{‘type’ => ‘button’, ‘value’ => ‘Free’, :onclick =>
‘set_priceKind_global(“free”)’}
Because of conflicting libraries, I’d like to wrap set_priceKind_global
thusly
(function($) {
// Lots of functions
function set_priceKind_global(priceKind)
{
switch(priceKind)
{
case “paid”:
case “free”:
break;
default:
var throw_msg = “Internal confusion in set_priceKind_global”
alert(throw_msg)
throw throw_msg
}
})(jQuery);
When I wrap it, Firebug reports that set_priceKind_global is undefined.
How do I expose set_priceKind_global as a function that the onclick can
trigger? Or, alternatively, modify the onclick so that the function can
be called?
Is there a javascript/jQuery forum that you can recommend?
Ralph S.