Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
890 views
in Q2A Core by
At the question page, upon selecting the category(or changing category) by user I would like to trigger a java script code. Something like this

If selectec category == category 1

   alert ('hi')

If selectec category == category 2

   alert ('bye')

how can i do that.

 

I would like to thank Sam55 for answering a related question here:

http://www.question2answer.org/qa/29452/place-category-drop-list-above-question-title-question-page?show=29720#a29720
Q2A version: 1.6.2
by
Category tag is generated asynchronously by ajax response. Therefore, I think that you cannot catch change event by general technique such as javascript and change() methods of jQuery. So that dkd903 says, it may be necessary to change qa-ask.js directly. Because I do not know javascript very much, I want to wait for the answer of other engineers.

1 Answer

+1 vote
by

There is already a javascript function qa_category_select(idprefix, startpath) change it from /qa-content/qa-ask.js file.

...