[Rails] Re: Observe field with jquery in Rails 3.1
Hans Marmolin wrote in post #1040373:
> $(document).ready(function() {
> $('#fieldset').bind({
> click: function() {
> alert('Change');
> // do something on click
> },
> mouseenter: function() {
> // do something on mouseenter
> };
> });
> });
> But nothing happens when I click in the field
> I suspect that I am using jquery in the wrong way
> I would appriciate any advice !
> Hans
I'd first try a simpler case just to make sure everything is "wired up"
correctly:
$(function() {
$('#fieldset').click(function() { alert{"Clicked"); });
});
If this works then you know you're finding the right HTML element and
correctly binding a "click." Once you've confirmed this then try the
more complex bind syntax.
P.S. I used the shorthand for waiting for the DOM ready event for
simplification & demonstration.
--
Posted via http://www.ruby-forum.com/.
--
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.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home