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
Rails Designer -
Given Ncube -
Rob Race -
Benoit Tigeot -
Top comments (2)
Nice post! But You mistyped "dataset" π
Thank you! I fixed it π