aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-08-19 16:45:18 +0100
committerDave Arter <davea@mysociety.org>2016-08-22 10:42:47 +0100
commitb296995e528da8f25328fdba7df71b4f50909e41 (patch)
treedb9c091f701314d14f5056332d979a1b1e6d070d
parentfde265673cd38e6d9d65d4bca7fe8c21a5955fc8 (diff)
Catch content changes with delegation/selectors.
e.g. if a report is pulled in to the page via JavaScript, we need this to run on the entry in the update form.
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index b3f6f5e60..4302ed8ff 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -401,13 +401,13 @@ $.extend(fixmystreet.set_up, {
},
contribute_as: function() {
- $('.js-contribute-as').on('change', function(){
+ $('.content').on('change', '.js-contribute-as', function(){
var opt = this.options[this.selectedIndex],
val = opt.value,
txt = opt.text;
- var $emailInput = $('#form_email');
- var $nameInput = $('#form_name');
- var $showNameCheckbox = $('#form_may_show_name');
+ var $emailInput = $('input[name=email]').add('input[name=rznvy]');
+ var $nameInput = $('input[name=name]');
+ var $showNameCheckbox = $('input[name=may_show_name]');
var $addAlertCheckbox = $('#form_add_alert');
if (val === 'myself') {
$emailInput.val($emailInput.prop('defaultValue')).prop('disabled', true);