Link_to + remote = true + Jquery + Rails 3

Hi All,

I have a drop down and each of the drop down values are links. On click
i populate a div with the results. Before the div is populated i show a
rotating spinner to give a feel to user that result will be updated. In
order to show the spinner i have a hidden div whose backgroud image is
spinner and i hide and show it as seen in timeline.js.erb file mentioned
below. However the first time i select any value of drop down and click
on it the spinner is not loaded ( ie ajax:beforeSend
("#spinnerTimeLineDiv3").show(); does not work ) however on subsequent
clicks of any value i get the desired result.

Anyone could suggest what cud be the issue??

Note : I am doing clearInnerHTML but the div in which spinner is present
is not part div3 which i am clearing.

==========================================================================
<%= link_to “You”, {:controller=>“messages”, :action => “timeline”,
:channelToViewTimeline =>“xyz”, :nameofchanneltoviewtimeline =>
“name”},{:remote => true} %>

The above link calls the below js which accordingly renders the partial
mentioned in js through jquery

timeline.js.erb

$(’#frmchannellist’)
.bind(‘ajax:beforeSend’, function(evt, data, status, xhr){
clearInnerHtml(‘div3’);
$("#spinnerTimeLineDiv3").show();
})
.bind(‘ajax:loading’, function(evt, data, status, xhr){
mclosetime();document.getElementById(‘selectedchannelfortimeline’).innerHTML
= ‘All’
})
.bind(‘ajax:success’, function(evt, data, status, xhr){
$("#spinnerTimeLineDiv3").hide();
$("#div3").html("<%= escape_javascript render ‘/test/timeline’
%>");
});

I am using jruby 1.6.0 rails 3.0 ruby 1.8.7