Topic: obtrusive JS?
The main reason I do this is because I guess it's the way I learned to do it in the first place.. But secondly, there is definitely an element of convenience to doing things the way I have done them. For example, I may do something with a select tag like:
:onchange => remote_function(:url => @some_var(@some_params), :method => :get)
Another thing that makes me question if doing things unobtrusively will serve me is that right now, my html and it's JS functions are linked together in a very visual way... I see:
<%- search_button = submit_tag '', :id => 'search_magnifying_glass', :onclick => "elementToggle('spinner', 'listing');" -%>
and I immediately know that submit button is going to call my toggle function. However, if there was no onclick there, I would have to go to my external JS file, and look up an ID called search_magnifying_glass and see what it's doing. Which also seems less convenient to me.
So, I would love to hear what you guys think regarding this, because I am interested in being the best programmer than I can be, and I am not necessarily attached to my ways-- I just need to understand why something should be done differently if it is A) working, and B) less of a headache... And I should add: C) completely indifferent from a user's perspective (since they are going to be required to use JS for the site to function anyway).
Thank you very much.