Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set the value for rendered attribute from JavaScript?

Tags:

javascript

jsf

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

<h:commandLink id="profileLink" rendered="#{bean.enable}">
like image 250
venkat Avatar asked Mar 04 '11 12:03

venkat


1 Answers

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
like image 120
BalusC Avatar answered Nov 03 '22 15:11

BalusC