Make text height 100% of div?

To get the result I wanted, I had to use this code: // Cache the div so that the browser doesn’t have to find it every time the window is resized. var $div = $(‘li.leaf.item’); // Run the following when the window is resized, and also trigger it once to begin with. $(window).resize(function () { … Read more

Limited selection in a JTextField/JTextComponent?

You can use a NavigationFilter for this. Here is an example to get you started: import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; public class NavigationFilterPrefixWithBackspace extends NavigationFilter { private int prefixLength; private Action deletePrevious; public NavigationFilterPrefixWithBackspace(int prefixLength, JTextComponent component) { this.prefixLength = prefixLength; deletePrevious = component.getActionMap().get(“delete-previous”); component.getActionMap().put(“delete-previous”, new BackspaceAction()); component.setCaretPosition(prefixLength); } public void setDot(NavigationFilter.FilterBypass fb, int … Read more

First letter Capitalize and other letters in lower case in css?

You could use text-transform in order to make each word of a paragraph capitalized, as follows: p { text-transform: capitalize; } It’s supported in IE4+. Example Here. 16.5 Capitalization: the ‘text-transform’ property This property controls capitalization effects of an element’s text. capitalize Puts the first character of each word in uppercase; other characters are unaffected. … Read more

Force download of ‘data:text/plain’ URL

As of now, it has been made possible to use <a download> in Chrome. Using dispatchEvent, you can download any string as file (even with a custom filename) whenever you want. Here’s a utility function to use it: var downloadFile = function(filename, content) { var blob = new Blob([content]); var evt = document.createEvent(“HTMLEvents”); evt.initEvent(“click”); $(“<a>”, … Read more