0

I can't able to hit the javascript when I click on the button. Previously the application is in Rails 3.2 and now I migrated to 4.2.6. I didn't change any js related ones. Please help. This is my code in short:

app/views/reports/_creation.html.erb:

<div id="instagram-inline-js">
  <%= render :partial => "photos_inline_js" %>
</div>
<a class="purple_button _round_5" id="select-files-upload-button">Select file(s)</a>

app/views/reports/_photos_inline_js.html.erb:

<script type="text/javascript">
    $('#select-files-upload-button').live("click", function() {
      $('#select-photos').show();
    });
</script>
venkat
  • 796
  • 1
  • 10
  • 28
  • [`.live`](http://api.jquery.com/live/) is removed in jQuery version 1.9., so use `.on()` - `$('#select-files-upload-button').on("click", function() {...})` – Vucko Jul 08 '16 at 14:42

2 Answers2

0

Try this .....

<script type="text/javascript">
    $('#select-files-upload-button').on("click", function() {
      $('#select-photos').show();
    });
</script>

Hope this will work for you.

live is deprecated .....

Please refer this answer jQuery 1.9 .live() is not a function

Community
  • 1
  • 1
Akshay Borade
  • 2,442
  • 12
  • 26
0

You can tried this code:

$(document).on("click", "#select-files-upload-button", function() {
  $('#select-photos').show();
});
Khanh Pham
  • 2,848
  • 2
  • 28
  • 36