I made this function with the intection to get the value of "select_sport" I tried to return but i don't know how can i take that value for use it in another script.
this is my function
 var selectSport_form = {
    urlSelect : CI_ROOT + 'search_sport',
    run : function() {
        selectSport_form.select_sport();
    },
    select_sport : function() {
        $(document).on('click', '#horiz_container img', function () {
                var img_selected = $(this), $li = img_selected.closest('li');
                var value_sport = $(this).attr('id');
                var $selected = $('#horiz_container .selected').removeClass('selected');
                $selected.find('.selected_sport').remove();
                $li.addClass('selected');
                $li.prepend('<div class="selected_sport"><img src="' + CI_ROOT + 'resources/img/select.png"></div>');
                return value_sport;
        });
}
};
And i tried to call it like that but doesn't work
    $(function(){
      selectSport_form.run();
      if(selectSport_form.select_sport() != "") {
        alert('Work');
      }
    });
 
     
     
     
    