I am attempting to use data from an html page in js.coffee script.
The view code is:
<span class="colHeader" data-wostatus-id="<%= wostatus.id %>"><span><%= wostatus.statuscode %></span></span>
Inspecting html looks like this:
<span class="colHeader" data-wostatus-id="4"><span>WAPR</span></span>
So far, so good.
My js.coffee file has:
alert($(this).data('wostatus-id'))
And the results I get = undefined
Thanks for the help!
Simply use jQuery and scan the document for whatever has the id:
This presumes there are multiple ‘ids’ on the page (thus the
each)