JQuery to load Javascript file dynamically

Yes, use getScript instead of document.write – it will even allow for a callback once the file loads. You might want to check if TinyMCE is defined, though, before including it (for subsequent calls to ‘Add Comment’) so the code might look something like this: $(‘#add_comment’).click(function() { if(typeof TinyMCE == “undefined”) { $.getScript(‘tinymce.js’, function() { … Read more

How to scroll up or down the page to an anchor using jQuery?

Description You can do this using jQuery.offset() and jQuery.animate(). Check out the jsFiddle Demonstration. Sample function scrollToAnchor(aid){ var aTag = $(“a[name=””+ aid +””]”); $(‘html,body’).animate({scrollTop: aTag.offset().top},’slow’); } scrollToAnchor(‘id3’); More Information jsFiddle Demonstration jQuery.offset() jQuery.animate()

Parse RSS with jQuery

WARNING The Google Feed API is officially deprecated and doesn’t work anymore! No need for a whole plugin. This will return your RSS as a JSON object to a callback function: function parseRSS(url, callback) { $.ajax({ url: document.location.protocol + ‘//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=’ + encodeURIComponent(url), dataType: ‘json’, success: function(data) { callback(data.responseData.feed); } }); }

Twitter bootstrap remote modal shows same content every time

The problem is two-fold. First, once a Modal object is instantiated, it is persistently attached to the element specified by data-target and subsequent calls to show that modal will only call toggle() on it, but will not update the values in the options. So, even though the href attributes are different on your different links, … Read more