From 01328164716aaa058329421901d73c5c7e782832 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 11 Jul 2018 19:12:01 +0530 Subject: [PATCH] profile fields: Fix fragile JavaScript for deleting date fields. The JavaScript click handler for this feature was fragile in a way that would break with upcoming changes to how we display the X element. We clean this up with a replacement implementation that should be much less fragile. --- static/js/settings_account.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/settings_account.js b/static/js/settings_account.js index 3603d96c57..faba94a91c 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -403,9 +403,9 @@ exports.set_up = function () { $('#settings_page').on('click', '.custom_user_field .remove_date', function (e) { e.preventDefault(); e.stopPropagation(); - var field = $(e.target).parent('.custom_user_field').expectOne(); + var field = $(e.target).closest('.custom_user_field').expectOne(); var field_id = parseInt($(field).attr("data-field-id"), 10); - $(e.target).prev(".custom_user_field_value").val(""); + field.find(".custom_user_field_value").val(""); update_user_custom_profile_fields([field_id], channel.del); });