venkat
venkat

Reputation: 101

Can I set the value for rendered attribute from JavaScript?

Can I set the value for rendered attribute of h:commandLink from JavaScript?

<h:commandLink id="profileLink" rendered="#{bean.enable}">

Upvotes: 6

Views: 8600

Answers (1)

BalusC
BalusC

Reputation: 1109532

No. The rendered attribute is for the server side, not for the client side. In plain HTML/JS in the client cide you can just toggle the CSS display property.

// Get element by client ID.
var element = document.getElementById('formid:buttonid');

// Hide it.
element.style.display = 'none';

// Show it.
element.style.display = 'inline'; // or 'block' if it's a HTML block element

Upvotes: 7

Related Questions