Topic: Focusing cursor unobtrusively?
I have a method that focuses the cursor in various inputs depending on the page:
def focus(domid)
raw("<script>$(document).ready(function () { $('##{domid}').focus(); });</script>")
endSo if you had a Person model with a Name attribute, on the form for the person you would specify:
<%= focus "person_name" %>And it works fine. However, this is raw JS output to the HTML file. Is there an alternative to having this same functionality but doing it unobtrusively?