ruby on rails 3.2 - jquery spin not replacing submit button for form -


i user spin.js , jquery.spin plugins show spinning icon ajax submitted items in web application.

it works great regular link buttons. submit button not show , can't figure out why.

here code:

form:

=form_for(@resource, :url => add_comment_resource_path, :remote => true) |f| =text_area_tag :comment,nil, :class => "span7", :rows => 3 =f.submit "add comment", :class => "btn authorize spin" 

js:

//= require spin.min //= require jquery.spin $('.spin').live('click',function(){ $(this).spin('small'); }); 

when click on submit button spinning icon should show. can see on page following gets inserted in html:

<input class="btn btn-small authorize spin" name="commit" type="submit" value="add comment"> <div class="spinner" style="position: relative; z-index: 2000000000; left: 537px; top: 950px; " aria-role="progressbar"></input> 

it seems spinner icon being nested inside input why not showing. how can show then?

there typo, change this:

$('.spin').live('click',function(){ 

to:

$('.spinner').on('click',function(e){ // can use `on()` instead of `live()` deprecated e.preventdefault() 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -