On maandag 11 juni 2018 20:11:36 CEST Simon Connah wrote:
> I like the idea of the custom attribute. I'll do that then.
The common way is to use a data- attribute[1].
--
Melvyn Sopacua
[1] https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/
Use_data_attributes
--
You received
Hi Vijay,
Thank you very much for the reply and sorry for the late reply.
You are completely right about not having multiple elements with the
same ID. I completely forgot that an ID was meant to be unique on a
page. I'll change it to a class.
I like the idea of the custom attribute. I'll do tha
I'm not sure why your code does not work (maybe there is a "race condition"
between the JS click handlers), but that global variable is a bad idea in
general.
You can add the comment ID as an attribute to your button, like
and in your event handler obtain the comment id
$("#like_comment_button
I know that the standard way to do this is to create a script tag with
a global JS variable in your Django template before you import your
other JS files but that won't work for my current situation.
I have an article detail view which is a single model instance. But I
also have a list of comment
4 matches
Mail list logo