Form validation in pure css

The new css3 specification two css selectors :valid and :invalid. These are basically a pseudo-class which can work together with the form input element . Suppose you have an input element to check if a user types something correct or wrong. For checking, you only need to use html5 required attribute. Now with the :valid/:invalid selector you can edit the color of an input field so the user knows if it is correct or wrong.

Continue reading...

Copy to Clipboard in pure javascript


copy to clipboard helps a user to quickly copy some particular text clicking on a button. Nowadays It’s a good user experience to avoid CTRL + C or right click open context menu and click copy.

Earlier we had to use some flash plugin to use this feature into a web app. The accessing clipboard was not enabled due to security reason. Now some modern browser supports document.execCommand() key method. In this tutorial, we’ll implement copy to the clipboard using few lines of pure javascript code, no jQuery, no flash .

Continue reading...