HTML and CSS Reference
In-Depth Information
</ section >
< footer >
< p > Created by < a href =" http://twostepmedia.co.uk "> Ben Howdle </ a ></ p >
</ footer >
</ div >
</ body >
</ html >
All we've got is a bit of Twitter self-indulgence, an input field and a submission button. Done!
The CSS is a bit off topic for this chapter, so I'll leave it to you to inspect the elements of
interest on the live website.
THE JQUERY
$ ( document ). ready ( function (){
//This is to remove the validation message if no poster image is present
$ ( '#term' ). focus ( function (){
var full = $ ( "#poster" ). has ( "img" ). length ? true : false ;
if ( full == false ){
$ ( '#poster' ). empty ();
}
});
I like validation messages to disappear when the user starts retyping in an input field. The
script below checks whether an image is present (i.e. a movie poster), and if not, empties the
container of the validation message once the input field gains focus.
//function definition
var getPoster = function (){
//Grab the movie title and store it in a variable
var film = $ ( '#term' ). val ();
Search WWH ::




Custom Search