1

I have a primefaces project and I'm facing a problem. I have a simple HTML component which is an input element of type hidden which gets its value from a backend bean. Now I need the value of that component as a javascript variable in order to validate it. How can I access the value from the hidden input element?

Manuel
  • 3,828
  • 6
  • 33
  • 48
Vinay
  • 55
  • 2
  • 6

1 Answers1

1

For the next time, please post what you have tried so far. You can't expect us to write code for you. Show a little bit of effort. But because in that case it is not too much:

If you have something like this

<input id="myHiddenComponent" type="hidden" value="something received from your bean" />

you can access it with jQuery for example

$('input#myHiddenComponent').val();

If you dont know the id, you can use other jQuery selectors and the jQuery find as well, pick one which suits you.

Manuel
  • 3,828
  • 6
  • 33
  • 48