On Sun, 2012-01-01 at 12:14 -0700, Ralph Shnelvar wrote:
> 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?
----
I had really good experience w/ IRC (freenode, #jquery) and using
jsfiddles.net for my code/example
Craig
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment