Skip to content

Commit

Permalink
Merge pull request #506 from OpenSourcePolicyCenter/bhard/fix_reverte…
Browse files Browse the repository at this point in the history
…d_taxbrain

Restore taxbrain.js file.
  • Loading branch information
brittainhard authored Mar 9, 2017
2 parents 2f42a2f + 969985d commit 1b3430c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions staticfiles/js/taxbrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ $('.form-group > label.btn-cpi').click(function (e) {
// only allow values to be entered if not equal to default
// if new values entered, show info about default value
$('.form-group > input.form-control').blur(function() {

input = $(this)
value = input.val()
value_default = input.prop('placeholder');
Expand All @@ -99,7 +98,11 @@ $('.form-group > input.form-control').blur(function() {
}
});


$("#tax-submit[type='reset']").click(function(){
$('.form-group.edited').each(function(){
$(this).removeClass("edited")
})
});

//
// Results page
Expand Down Expand Up @@ -160,3 +163,19 @@ $('#current-year-modal').on('hide.bs.modal', function (e) {
$('#start-year-select option').removeAttr("selected");
$('#start-year-select option[value="' + currentYear + '"]').attr("selected", "selected");
});

$(document).ready(function(){
$('.form-group > input.form-control').each(function() {
input = $(this)
value = input.val()
value_default = input.prop('placeholder');
value_changed = (value != '') && (value != value_default);
group = input.closest('.form-group')
if (value_changed) {
group.addClass('edited');
} else {
input.val('');
group.removeClass('edited');
}
})
})

0 comments on commit 1b3430c

Please sign in to comment.