Jquery data and elixir tags

how to pass a jquery data into elixir view tags e.g

jquery data
let id = $(this).attr(‘mid’);
elixir tag
$(’#anchor’).attr(‘href’, "<%= Routes.cards_path(@conn, :fetch_card, data: id) %> ")

pass the id value to data atom in the elixir tag?

You can to it like that.

I usually do that stuff with a data-attribute on the html element.


<div data-url="<%= Routes.cards_path(@conn, :fetch_card, data: id) %>">

But that requires that the id comes from iterating some sort of list, right?

not really … the idea is getting data value from an id…so passing it into the elixir tag is an issue