for (buttonIndex = 0; buttonIndex != buttonArray.length; ++buttonIndex) {
jQuery(my_array).each(function(element){ … });
// or
jQuery.each(my_array, function(element){ … });
// whenever a button with the callback class is clicked, make a JSON
// request to the server, passing in the button's id as input, and taking the
// HTML response and replace it into a content div. update the div's style
// as dictated by the response, and then display a message to the user
// inside a different div.
jQuery('input[type="button"].callback').click(function(button){
jQuery.getJSON('/api', {action:this.id}, function(data){
jQuery('div.content')
.html(data.response.html)
.css('border', data.response.border)
.css('color', data.response.color);
jQuery('#messages').append(jQuery('<span class="message">'+data.response.message+'</span>'));
});
});
This screenshot shows pretty clearly what's going on. Now, The javascript in question is in 3 files: postboxplain.js, library.js, and menus.js. Library.js is the mootools javascript library and if I disable that script (by commenting it out of the html) the undefined buttons aren't there anymore. So I know the problem is somewhere in there. But I don't know enough about javascript to be able to pinpoint it, so I'm hoping someone here can help me figure this out.
[Edit:] On an unrelated note, I can't win with IE. If I get the menus to work, it can't seem to understand <span> tags, but if it doesn't have the menus then.. well. It understands <span> tags. :mutter: