0

I have a one page Xhtml (JSF) that takes information from BD.This information is rendered on diferent divs that will be controlled with a List. Only one div can be show at same time and other must be hidden.

Itis very easy when you have static values, but now I dont know how to reffer the selected item and make actions with it.

pseudocode:

<script>
new array int [10];
int count=0;
</script>

//**list where you can select one item to show o hide DIV** 
<ui:repeat value="categories"><li>ITEM</li></ui>

**//all divs with diferent ID**
<ui: repeat values ="main.categories" var="elements">

<div id="main.divNumberX()" hidden>

<script>
array[count]=main.getNumerDiv();
count=count+1;
</scrip>

<ui:repeat values=#{categories.get(element)} var=item>
    #{item.getNombre} ...etc

</ui>

</div>
</ui>

$(document).ready(function() {

            //I dont know how to do here .... 

                });

I think to use an array that keep the number and the position but im not abble to take of the information from the Eventclick. ¿Someone know can I do this?

Thanks to all!!!

Jorge A
  • 19
  • 5
  • But if all of them have the same classname, ¿how i know whats clicked and which of them must stay hidden? – Jorge A Jan 02 '16 at 15:50
  • Man if was easy I dont ask here. I think that me or you dont understand the problem. The element that I clicked, its not the same where I work. the click its made on a list that can change. then recovery the element that can have an "asociate" Div. I DONT wont to active the div where i stay . I want to search the div with the same "name" on my HTML and make things with it and the others. – Jorge A Jan 02 '16 at 15:56
  • You can use the "starts with" jQuery selector. If all the IDs start with "Jorge-", then you can trap the event clicks on these IDs: `$('[ID^=Jorge-]').click(function{ alert( this.id +" - "+ this.value ); });` The code that runs inside the function has access to the attributes and value of that specific element, as in my example. – cssyphus Jan 03 '16 at 04:17

0 Answers0