Skip to content

Intera/jquery.contenttitle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery.contenttitle

Setup input fields\elements that have their title as content. Much like the HTML5 placeholder functionality - but jQuery powered.

  • If content empty - reset to title
  • If content not empty - leave it untouched
  • If content is title, on focus - empty the field

Additional features:

  • Setup multiple elements at once
  • Adds a class when the title is displayed. For example for displaying the title in a different color.
  • Works for <input>, <select>, <textarea> and maybe others
  • If the title attribute is used, the browser automatically displays a tooltip for it on hover.

Dependencies

  • jQuery

Example usage

Html

<input title="search..."/>
<input title="type here..."/>

Javascript

$("input").contentTitle()

Options

$(selector).contentTitle({
  optionName: optionValue, ...
})
optionName description default value
title_attribute use this attribute to set the content title "title"
title use this text as content title false
title_selector selector to get the content title from html element content false
title_class class to be used if the content title is displayed "contentTitle"

License

GPL version 3 or later

About

Setup input fields\elements that have their title as content.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published