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?
            Asked
            
        
        
            Active
            
        
            Viewed 3,779 times
        
    1
            
            
        - 
                    I've edited and rephrased the question, it should be clearer now. – Manuel Sep 12 '13 at 07:38
 - 
                    https://stackoverflow.com/questions/11558654/get-value-text-from-pinputtext-javascript – Andrew Oct 05 '17 at 18:53
 
1 Answers
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