A while back I wrote a series dealing with loading content and JSON data with jQuery and AJAX which culminated in the post "Load JSON data with jQuery, PHP and MySQL" which brought all the techniques together and loaded JSON data into select boxes when the first was changed. I was recently asked how to do this using radio buttons instead, which I show how to do in this post.
There is a bug in older versions of TinyMCE when using Webkit based browsers (Google Chrome and Apple’s Safari) which added and failed to remove hidden divs with the id _mcePaste. This post looks at the problem and offers two solutions: upgrade TinyMCE completely, or just upgrade the paste plugin.
I was asked a couple of days ago on my get and set form values with jQuery post how to make a secondary select box appear with jQuery when the first one is changed. The first might contain a list of countries and the second one some cities which changes as the country changes, allowing the user to select both their country and city. This post shows how to do this with several hidden sub-selects, and an earlier post shows how to do it with JSON and AJAX.
It’s simple… add a to the end of each line with nothing after it and you have a multi-line string:
var s = "abc def ghi jkl";
Now display the above:
Note that the newlines are not rendered at all, so you need to make sure the appropriate spacing or line breaks (n) etc are present in the string.
Another approach I found is shown below, but as far as I can tell it only works in Firefox 2+ and not at all in IE, Opera, Chrome and Safari.
var s = (<r><![CDATA[abc def ghi jkl]]></r>).toString();
This does render the line breaks so if you used window.alert on the above it would show:
abc def ghi jkl
So don’t use the second approach due to lack of browser support 🙂
Amazingly some people still use <frameset> and <frame> tags around the web, as I discovered the other day when someone linked my Running Calendar website into their frameset website. A common approach to this problem is to detect if the page is in a frameset and to bust out of it; in this post I offer an alternative which is to change the target for all links to _top where a target is not already set.
A few days ago I showed a basic example using the jQuery Facebox plugin to open dialog windows where particular links are made to open in a Facebox dialog. I was then asked in a comment how to open a dialog without making it opened from a link; this is covered with a brief example on the Facebox page but I’ve covered this a little more comprehensively in this post.
Over a year ago I posted how to use jQuery to make all offsite links open in a new window. I recently received a comment on that page asking how to make the title attribute of all anchor tags on a page for offsite links be the same as the href. This post shows how to do this with jQuery, but also leaves any <a> tags with a title as-is.