Use Case: Export Apple Reminders from MacOS application to cleaned plain text, i.e. remove unwanted spaces, blank lines and square brackets PROCEDURE Click on a single item in the MacOS Reminders app list Select All (either Command-a or use Edit->Select All) Copy (either Command-c or use Edit->Copy) Open Terminal Run cleanme Paste the copied reminders […]
An HTML file input can’t be cleared by normal means (i.e. setting the value to null or an empty string) because of browser security restrictions. In most browsers, setting a null value attribute either will have no effect or cause an error. Creating a new element that clones the old element and swap the two […]
The ability to validate BEFORE a form is submitted greatly reduces end-user frustration by telling the user immediately what the issue is. The jQuery Validation plugin does just that. Here is a link to the plugin’s home page: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ This is a simple recipe for doing custom password validation: In the html head
Here is a VERY simplistic watermark code snippet. It has the distinct disadvantage of submitting the watermark string as the field value, and does not set the initial field value either…YMMV…
1
2
3
4
5
6
7
jQuery('#yourInput')
.focusin(function(){
if(jQuery('#yourInput').val()=='Enter keywords to search for')jQuery('#yourInput').val('');
})
.focusout(function(){
if(jQuery('#yourInput').val()=='')jQuery('#yourInput').val('Enter keywords to search for');
Original Post: http://stackoverflow.com/questions/991367/how-to-get-the-form-parent-of-an-input Native DOM elements that are inputs also have a form attribute that points to the form they belong to: var Form = element.form; alert(jQuery(Form).attr(‘name’)); Use the jQuery closest() function for NON-INPUT elements: var $form = jQuery(element).closest(‘form’); alert($form.attr(‘name’)); Another cool post: http://stackoverflow.com/questions/311579/jquery-js-how-do-i-select-the-parent-form-based-on-which-submit-button-is-clic