Categories
Javascript PHP

jQuery Watermark shadow effect on Input box

How to create watermark / shadow effect on Input type textbox? How to get watermark using jQuery ?

using jQuery watermark on input box
You can add default text on form elements that look like watermarks or work as placeholders. Using jQuery and bit of CSS rules, you can easily achieve the watermark effect. This is very handy if you want to prevent unwanted information to be sent to the server, as can happen with the default watermark text. It’s really very simple using jQuery. There is no need to write long Javascript function to check the value and populating default text onblur/onfocus/onclick/onchange… etc.

A simple jQuery example to show you how to implement a watermark text effect on an input field.

Just follow three steps and it’s done.

1) Create textbox in your HTML file

<input type="text" name="zipCode" id="zipCode" value="Enter Zip Code" />

2) Create CSS class for Dim effect (watermarking theme)

.watermarkEffectText {
    color : #9B9B9B;
}

3) Javascript code

$( document ).ready(function() {
	// apply class
	$("#zipCode").addClass("watermarkEffectText")

	// set default value (If you've not assigned in HTML, else skip this line) 

	// assigning in HTML doesn't wait for DOM load, and reflects immediately
	.val("Enter Zip Code")

	// on gaining focus
	.focus(function() {

		if( $(this).val() == "Enter Zip Code" ) { // remove default value
			// remove class and value
			$(this).removeClass("watermarkEffectText").val("");
		}
	})
	// on loosing focus
	.blur(function() {
		if($(this).val() == "") {
			// set default value with watermark effect
			$(this).val("Enter Zip Code").addClass("watermarkEffectText");
		}
	});
});

1, 2, 3… it’s as simple to achieve watermark effect.

'Coz sharing is caring
Categories
Database MySQL PHP

MySQL vs. MySQLi

MySQL is a relational database management system (or RDBMS) – meaning that it is a database management system based on the relational model. This RDMS runs as its own server and provides multi-user access to multiple databases at once. The source code of MySQL is available under the terms set forth in the GNU General Public License as well as a plethora of proprietary agreements. Members of the MySQL community have created many different branches of the RDMS – the most popular of which are Drizzle and MariaDB. As well as being the prototype of several branches, most free software projects that must have a full featured database management system (or DMS) use MySQL.

MySQLi Extension (or simply known as MySQL Improved or MySQLi) is a relational database driver that is used mainly in the PHP programming language. It provides an interface to the already founded MySQL databases. It is quite literally an improved version of its predecessor, MySQL; which was simply a means to manage databases over servers.

MySQL can be found in many web applications as the database component of a solution bundle (or LAMP) software stack. Its use can be seen widely in such popular web sites as Flickr, FaceBook, Wikipedia, Google, Nokia, and YouTube. Each one of these websites use MySQL for storage and the logging of user data. The code is comprised of the C and C++ languages and uses many different system platforms –including Linux, Mac OS X, and Microsoft Windows.

The MySQLi extension comes equipped with many benefits that compliment as well as improve those that were provided by its predecessor, MySQL. There are a few that are more prominent than others. These features that are meant to enhance the functionality of the MySQL (as well as provide an update to the database manager as a whole) are an object oriented interface, support for statements that have been previously prepared, support for a variety of statements, support for any kind of transaction that takes place, an enhanced level of debugging support, and an enhanced level of server support that is already embedded in the infrastructure of the database.

As an RDBMS, it is not required that MySQL be shipped with GUI tools in order to administer the databases or manage the data therein. It is possible for users to use a command line tool or download MySQL Frontends from a variety of parties that have the software necessary and web applications to manage the databases, build the databases, and work with the data records.

Summary:

1. MySQL is an RDBMS that runs as a server and provides multi-user access to multiple databases; MySQLi is an extension of MySQL.

2. MySQL does not need GUI tools in order to administer databases or manage the data therein; MySQLi builds upon the features of MySQL and include object oriented interface, support for previously prepared statements, and enhanced embedded server support.

'Coz sharing is caring