$('#listLeft ul li a').live("click", function() { // alert("foo"); // e.preventDefault(); if ($(this).hasClass("listLeftSelected")) { return false; } $('.listLeftSelected').removeClass("listLeftSelected"); $(this).addClass('listLeftSelected'); var objId = $(this).attr("data-id"); var tabId = $('.innerSelected').attr("data-id"); $.getJSON("/m/get_details", { 'tab_id': tabId, 'object_id': objId }, function(data) { $('#textRight').text(data.title).formatTitle(); var searchTerm = $('.searchListField').val(); var html = data.html; if (searchTerm != '') { html = highlightWordsNoCase(html, searchTerm); // html = html.replace(searchTerm, "" + searchTerm + ""); } $('#bottomRight').html(html); // console.log(data); }); return false; }); $('.toggleNext').live("click", function(e) { e.preventDefault(); var $next = $(this).next(); if (!$next.is(":visible")) { $next.slideDown(); } else { $next.slideUp(); } }); function highlightWordsNoCase(data, word) { var regex = new RegExp("(" + word + ")", "gi"); return data.replace(regex, "$1"); } /* Get a jquery