Simple Tool: LT and GT Replace

This page replaces “<" and ">” with “&lt;” and “&gt;”. I found myself doing it in my blog posts and thought it would be a good, simple exercise to do in my portfolio space and could be used by myself or others in the future.

Enter code here:

Updated code will display here:

The jQuery code itself doing the replacing:

(function($) {
	$("#btnReplace").click(function() {
		var str = $("#PutCodeHere").val();
		str = str.replace(/</g, "&lt;").replace(/>/g, "&gt;");
		str = str.replace( /\r?\n/g, "\r\n" );
})( jQuery );

Source for figuring out what I needed found here: