From Rails
<%= link_to(
'likeπ',
'#',
id: 'like',
data: {
userId: current_user.id
})
%>
To JS
$('#like').click(function(event){
console.log(event.target.dataset.userId)
})
For further actions, you may consider blocking this person and/or reporting abuse
Brandon Weaver -
Alexandre Calaça -
Kirill Usanov -
Giovanny Cordeiro -
Top comments (2)
Nice post! But You mistyped "dataset" π
Thank you! I fixed it π