Placeholder in IE7

I am tired of several placeholder plugins to make it work in IE. I am currently using http://widgetulous.com/placeholderjs/ . This works in IE8 and 9, but not in IE7. It returns SCRIPT1028: expected identifier, line or number of placeholder.js, line 182 character 5 SCRIPT5009: Placeholder undefined csr-form.html, line character 72 - Here I call placeholder.js through:

$(function(){ // Placeholder Placeholder.init(); }); 

Does anyone know how to make this work in IE7, or can someone suggest another plugin that works in IE7?

UPDATED Here is the fiddle, http://jsfiddle.net/clintongreen/NLWRL/

thanks

+6
source share
2 answers

ah, your problem is the trailing comma in a hash like this

 { 'this':'blows', 'up': 'ie7', } 

edit : yep, I see your utils hash in this script has a comma after it.

here's the fix : http://jsfiddle.net/NLWRL/1/

not tested in ie7, there might be more hidden commas so you can find

By the way, when you see Expected identifier, string or number in ie7, 9/10 times for its final comma.

+4
source

I use Placeholder-jQuery-Plugin from mathiasbynens at work.

He says that IE6 + is supported, and we had no problems with IE7.

Usage - nice - set the placeholder attribute in your input tags and call $('input').placeholder(); in $(function())

+9
source

Source: https://habr.com/ru/post/900749/


All Articles