- shared 20 Mar honing definitions
- delicious 13 Aug ´19 Wallace CLI
- delicious 29 Oct ´18 Learning To Code By Writing Code Poems
- shared 02 Jan ´18 A Better Way to Code – Mike Bostock – Medium
- twitter 18 Nov ´15 Use #copy followed by #paste in your #code base and 25 hamsters are being killed #cleancode
- delicious 05 Jun ´13 CodeMirror
- delicious 06 May ´12 Textastic - Text, Code and Markup Editor with Syntax Highlighting - FTP, SFTP, Dropbox - for iPad¬es=
- delicious 06 May ´12 Textastic - Text, Code and Markup Editor with Syntax Highlighting - FTP, SFTP, Dropbox - for iPad¬es=
- delicious 02 Apr ´11 CSS Code Snippets To Make You A Better Coder
- delicious 02 Apr ´11 CSS Code Snippets To Make You A Better Coder
- delicious 11 Mar ´11 Google Code Playground
- delicious 11 Mar ´11 Google Code Playground
Making block elements link
There is no standard way of linking block elements to pages in HTML. But sometimes you do need it. The <a>-element doesn't support any block elements inside (such as <div> etc.). I solve the problem with a jQuery snippet that allows me to simply add 'js_blocklink' to a block elements class and the jQuery code deals with the rest. It does assume that the first link is the 'main link' (also needed for graceful degradation when Javascript for some reason is not available). A bonus feature is that other links may still exist, and stay working. function enableJsBlockLinks() {     $(".js_blocklink").each(function() {         $(this).click(function() {             $(this).find("a").each(function(index) {                 a = $(this).attr("href");                 if (a…
- delicious 28 Jul ´10 ★ An Improved Liberal, Accurate Regex Pattern for Matching URLs
- delicious 28 Jul ´10 ★ An Improved Liberal, Accurate Regex Pattern for Matching URLs
Suggesting input - a jQuery snippet
Today I'd like to share with you a snippet that simply uses the 'title' value of an input to make a suggestion. It degrades nicely, also users with Javascript turned off are able to get the hint, by hovering over.
$('input[title]') .val( function(i,value) { return value == "" ? $(this).attr("title") : value; }) .focus( function() { if ($(this).attr("title") == $(this).val()) $(this).val(""); } ); // added: don't submit the suggested values $('form').submit(function() { $('input[title]').val( function(i,value) { return value == $(this).attr("title") ? "" : value; } );
});
For optimal userfriendlyness, make the suggested input a little less dark than the user filled in ones.
BTW. It assumes you are already using the jQuery library.
Dit artikel van murblog van Maarten Brouwers (murb) is in licentie gegeven volgens een Creative Commons Naamsvermelding 3.0 Nederland licentie .