Reputation: 949
For some reason Jade seems to add the HTML entity for a double quote to the start and end of the _id string when it's not concatenated with an empty string.
Jade:
var post = {_id: ObjectId("551ce90c036474a3805e30cf")};
button(data-id=post._id, data-action='give') Give
HTML:
<button data-id=""551ce90c036474a3805e30cf"" data-action="give">Give</button>
Jade:
var post = {_id: ObjectId("551ce90c036474a3805e30cf")};
button(data-id='' + post._id, data-action='give') Give
HTML:
<button data-id="551ce90c036474a3805e30cf" data-action="give">Give</button>``
Is there anyway to fix this or am I just doing something wrong?
Upvotes: 2
Views: 736
Reputation: 34647
post._id
is an object which gets stringify
'ed that results in the quotation marks.
Use post.id
it's a string by default.
Upvotes: 3