How to use jquery to show divs based on select box? This is a follow on to my previous question. I didn't want to make ajax calls for this and instead loaded all the term field text with views_get_view_result(). Then I looped over the results and created divs within the node add/edit form.

I know have for every term option in the select box a hidden div:

&lt;div id=help123 style="visibility:hidden;"&gt;help text for termid 123&lt;/div&gt;


I added a 

scripts[] = custom.js


to my module.info file with:

(function($){
$("#edit-field-disc-topic-und").click(function(){
    var option = document.getElementById("edit-field-disc-topic-und").value;     
    document.getElementById(option).style.visibility ="visible";
})
})(jQuery);


Should I post this on Stackoverflow instead?
you ommited the drupal.behavior, that s probably why it doesnt do anything.
And i would suggest working with classes instead changing style. In your css you create a style with visibility:hidden, apply it to each element and then remove it on click. (and add it again once you clicked on something else ...)

document.getElementById doesnt make much sense there ... you can write it better like this : 

(function($){
Drupal.behaviors.taxdescGetDesc = {
  attach: function (context) {
    $("").click(function(event)){
    option = $(event.currentTarget).val();
    $('#'+option).removeClass("hidden");
  }
}