jQuery(document).ready(function($) {
    // Event handler for adding social item
    $(document).on('click', '.newscope-social-add', function(e) {
        e.preventDefault();
        var socialWrapper = $(this).prev('.newscope-social-wrapper');
        var socialItem = socialWrapper.find('.newscope-social-item').last().clone();
        socialItem.find('input[type="text"]').val('');
        socialItem.find('select').val('');
        socialWrapper.append(socialItem);
    });

    // Event handler for removing social item
    $(document).on('click', '.newscope-social-remove', function(e) {
        e.preventDefault();
        $(this).closest('.newscope-social-item').remove();
    });
});

