var $container = $('.manager-group-list-body'); var $managerGroupItem = $container.find('.manager-group-item-<%= @manager_group.id %>'); if($managerGroupItem.length > 0){ $managerGroupItem.find('.manager-group-name').html('<%= @manager_group.name %>'); } else { $container.append('<%= j(render partial: 'partners/shared/manager_group_item', locals: { manager_group: @manager_group }) %>'); } $('.partner-save-manager-group-modal').modal('hide'); showSuccessFlash();