What is the id/class of the currently viewed topic (want to extract data from it)


If a user creates a new topic I would like them to be able to have an image displayed above the topic whenever people are reading their post. So they would insert the image url will be in the format
The end colon is just to make it easy to extract from the topic content.

My question is, using js or jquery, how do I read the content of the currently displayed topic (so I can extract the image url if there is one). I have successfully read it from the header meta tag but that doesn’t distinguish between the currently open topic and the suggested topics.

Or is there a way to add an extra field for topic posts and how do I read that with js or jquery?

(Robin Ward) #2

As always I recommend learning Ember.js and customizing your site properly with a plugin, because it’s less fragile and more likely to work in the long term. However, if you just want to hack something up quick in jQuery you can extract the current topic id like this: $('#topic').data('topic-id')


a quick hack will likely do for now (may regret it :slight_smile: