This appears to be a JavaScript issue, or maybe an HTML issue. In a
browser, looking at the page, Control-click on the element you are
trying to read (you may need to change it to a text input if it is a
hidden element at the moment) and choose Inspect Element from the
contextual menu. See what the ID of that field really is.
The jQuery code you posted should work. Try it old-school with
console.log(document.getElementById(‘club_id’).value) and see what that
gives you. If the ID is not exactly club_id, or if there is more than
one such element in the page, then you may get an instructive error.
Please notice that the <%= … %> expression for the partial is in an erb
file and is evaluated on the server before it is sent to the user’s
browser. It is therefore not possible to have javascript variables be
part
of the expression. You need to rethink the partial and instead of using
ruby variables it will have to use javascript variables.
Den söndagen den 23:e november 2014 kl. 14:38:39 UTC+1 skrev Ruby-Forum.com
User:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.