83380

Placeholders in IE

I am using this script : http://www.morethannothing.co.uk/wp-content/uploads/2010/01/placeholder.js to get some placeholders into IE. Works a treat for input types of text and password.

But just does'nt seem to load for Text Areas. Does anyone know of a line of code I could add to that, or maybes a little bit of jQuery or JavaScript to execute to get it to load.

Thanks in advance.

Answer1:

instead of $(':text[placeholder],:password[placeholder]') use $(':text[placeholder],:password[placeholder],textarea[placeholder]')

Answer2:

For all inputs and textarea: $('input[placeholder],textarea[placeholder]')

Answer3:

<script type="text/javascript"> if(navigator.userAgent.indexOf("MSIE") > 0 ) { $(function() { var input = document.createElement("input"); if(('placeholder' in input) == false) { $('[placeholder]').focus(function() { var i = $(this); if(i.val() == i.attr('placeholder')) { i.val('').removeClass('placeholder'); if(i.hasClass('password')) { i.removeClass('password'); this.type='password'; } } }).blur(function() { var i = $(this); if(i.val() == '' || i.val() == i.attr('placeholder')) { if(this.type=='password') { i.addClass('password'); this.type='text'; } i.addClass('placeholder').val(i.attr('placeholder')); } }).blur().parents('form').submit(function() { $(this).find('[placeholder]').each(function() { var i = $(this); if(i.val() == i.attr('placeholder')) i.val(''); }); }); } }); } </script>

Recommend

  • How can I use a treetable to show all rows in an Oracle SQL table?
  • Calculate distance between 2 lon lats but avoid going through a coastline in R
  • Fixing a slow GridView
  • Getting States and Provinces in .NET
  • Selenium: find element by visible Text
  • How can I escape backslash in logstash grok pattern?
  • curl not working for getting a web page content, why?
  • Apple review objection Invalid directory name for Plugins folder (Child Browser Cordova)
  • Cast between interfaces whose interface signatures are same
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Loading .coffee files via a view in Rails
  • jQuery ready not fired after rails link_to is clicked
  • Create DicomImage from scratch using Dcmtk
  • MongoError: Incorrect arguments
  • Allowing both email and username for authentication
  • Django rest serializer Breaks when data exists
  • C++ Partial template specialization - design simplification
  • Get one-time binding to work for ng-if
  • Javascript simulate pressing enter in input box
  • HTML download movie download link
  • AES padding and writing the ciphertext to a disk file
  • How to convert from System.Drawing.Color to Excel.ColorFormat in C#? Change comment color
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • Updating server-side rendering client-side
  • Validaiting emails with Net.Mail MailAddress
  • MySQL WHERE-condition in procedure ignored
  • How do you troubleshoot character encoding problems?
  • jQuery tmpl and DataLink beta
  • Web-crawler for facebook in python
  • How to disable jQuery.jplayer autoplay?
  • trying to dynamically update Highchart column chart but series undefined
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • How to set the response of a form post action to a iframe source?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Authorize attributes not working in MVC 4
  • Django query for large number of relationships
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • How to load view controller without button in storyboard?