ChrisCa
ChrisCa

Reputation: 11026

jQuery template renders hidden form field as a visible input box in IE

I am using jQuery templates to add new items to a list when a button is pressed

The template contains a hidden field.

When I add a new item to the list in IE 8 or IE 9, then the hidden form field is displayed like a visible input field

I've set up a JSfiddle to demonstrate http://jsfiddle.net/T3has/8/

It works fine in Chrome and FF, but not IE

Any ideas?

Upvotes: 2

Views: 610

Answers (2)

Drejer
Drejer

Reputation: 135

You could add .hide() to the line where you append.

The function .tmpl() is marked as a beta feature in jQuery, and is not being further developed.

"The jQuery team has decided not to take this plugin past beta. It is no longer being actively developed or maintained." Source: http://api.jquery.com/tmpl/

Try using this code instead:

$('#rateItemTemplate').clone().removeAttr('id').appendTo('#Board');

jsFiddle: http://jsfiddle.net/T3has/10/

Upvotes: 0

WhyNotHugo
WhyNotHugo

Reputation: 9924

You're doing it right; the input is of type "hidden", so this is clearly (yet another) bug in IE.
If you want to support IE you may want to try adding a class to those inputs as a hack around this:

<input class="hidden-input" ...

and css

input.hidden-input: {
  display: none;
}

Upvotes: 2

Related Questions