Nacho321
Nacho321

Reputation: 1991

Adding jsf attribute using jquery

I'm working with jsf 2.0 and jquery 1.9.

I'm trying to create a placeholder for an input field. However, jsf 2.0 removed the placeholder attribute for <h:inputText> components. I believe the jquery 1.9 has something to add attributes to certain components, but honestly, I've never used jquery.

What's the syntax to add the placeholder attribute?

Thanks!

--EDIT-- I'm adding a bit more of code to give a bit of context.

<h:inputText id="input" value="#{bean.getValue}" />

I need this to be rendered with a placeholder that says "Fill me".

Upvotes: 0

Views: 746

Answers (1)

Derek
Derek

Reputation: 3435

You can use $('#input').attr('placeholder', 'Fill me');

Of course, be aware that the placeholder attribute is not fully supported in some browsers.

Upvotes: 2

Related Questions