Rails with JQuery DIV manipulation

Posted by MrThomas on Stack Overflow See other posts from Stack Overflow or by MrThomas
Published on 2010-03-26T17:41:48Z Indexed on 2010/03/26 17:43 UTC
Read the original article Hit count: 328

Filed under:
|

Say I have a loop of objects (style.cover.pic) in a DIV .style_image

<% @styles.each do |style| %>

<div class="style_image"> <%=link_to (image_tag style.cover.pic.url(:small)), style %></div>

With the use of JQuery On a click event I want to load (this.href) in to the div .style_image which was click not all of the .style_image DIV's.

this is what I have done so fare:

$(function() {

$(".style_image a").live('click', function(event) { 


    $(".style_image a").load(this.href + " #show_style");

    $.get(this.href, null, null, "script");
    return false;       

});
});

Can this be done? and yes how???

Regards

Dan

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ruby-on-rails