Hi Veronica,
The code causes issues in "All Courses" page such that all image and links are no longer working.
but I've managed to fix the code.
It still doesnt work the way I want it to in "All Courses" page, but I think it's good enough for now.
The final code is as below:
jQuery('#buddypress').on('bp_filter_request',function(){
jQuery('ul#course-list .course_single_item .item-avatar a,ul#course-list .course_single_item .item-title a').click(function(event) {
var $this = jQuery(this);
var nearestform = $this.closest('.course_single_item').find('.item-credits form');
if (nearestform.length > 0) {
event.preventDefault();
$this.closest('.course_single_item').find('.item-credits form').submit();
}
});});