Click here to Skip to main content
15,881,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a items in a list and i want then when i click in "+links" the list update to my other list. Im trying to do this with jquery but im not having the results. Where might be the error?


XML
<footer id="footer-container">
      <section id="footer1">

          <ul id="showfirst">
             <h1>Links</h1>
             <li><a href="#">Link 1</a></li>
             <li><a href="#">Link 2</a></li>
             <li><a href="#">Link 3</a></li>
             <li><a href="#">Link 4</a></li>
             <li><a href="# id="next"> + links </a></li>
          </ul>

          <ul id="showsecond">
             <li><a href="#">Link 5</a></li>
             <li><a href="#">Link 6</a></li>
             <li><a href="#">Link 7</a></li>
             <li><a href="#">Link 8</a></li>
             <li><a href="#">+ links</a></li>
          </ul>

       </section>
   </footer>


HTML
<script type="text/javascript">
    $('#next).click(function{
  
    $('#showsecond').show();

});
</script>
Posted
Comments
Sergey Alexandrovich Kryukov 28-Feb-14 17:33pm    
Error in what?! You are not showing any script trying to update anything at all. What exactly are you trying to achieve? Is it something like paging? Why? Does not see to make any sense...
—SA
mibetty 28-Feb-14 17:44pm    
Thanks for answer. Im starting study jquery and i thought i was doing right. I have a list of links and when i click in "+ links" i want that the first list of items change to the other list that i have.

1 solution

As I say, you are not trying to change anything except visibility. The purpose of all this remains unclear. To change content, you need… change it. Everything is explained here:
http://api.jquery.com/category/manipulation[^].

—SA
 
Share this answer
 
Comments
mibetty 28-Feb-14 18:40pm    
One more time thank you! What i need to do is update my list with other values that are in the my other list, i can´t do that with css so o think the solution is with jquery so im trying to learn how i can do this.
Sergey Alexandrovich Kryukov 28-Feb-14 19:49pm    
Well, CSS just define styling, it cannot change anything. You need to understand two thing: 1) separate "real" content (let's say, DOM structure of HTML) and its presentation, 2) learn how to modify one and the other. In particular, each CSS class is static, but you can use Javascript to change association between elements and style (add/remove/toggle style). To change DOM content, you need to use methods referenced above.
Will you accept the answer after all (green "Accept" button)?
—SA
mibetty 1-Mar-14 10:14am    
Thanks, with your information, i did it now :)
Sergey Alexandrovich Kryukov 1-Mar-14 13:21pm    
You are welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900