Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
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:

Q2A version: 1.6.2
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

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