datatracker/static/js/nomcom.js
Emilio Jiménez e1a518720b Add javascript to change initial text related with position
Refactor nomcom forms.
See #913
 - Legacy-Id: 5154
2012-12-26 12:00:25 +00:00

36 lines
975 B
JavaScript

/*jslint vars: false, browser: true */
/*global jQuery */
(function ($) {
"use strict";
$.fn.nominateForm = function () {
return this.each(function () {
var $position = $("#id_position"),
$comments = $("#id_comments"),
baseurl = "/nomcom/ajax/position-text/";
$comments.change(function () {
$.ajax({
url: baseurl + $position.val() + '/',
type: 'GET',
cache: false,
async: true,
dataType: 'json',
success: function (response) {
$comments.text(response.text);
}
});
});
$position.change(function () {
$comments.trigger("change");
});
});
};
$(document).ready(function () {
$("#nominateform").nominateForm();
});
}(jQuery));