HI,


I am dynamically generating a unordered list. I want to get value("somevalue") inside each <li> item. How can i access it please help me.

<ul>
<li value="somevalue" > item1 </li>
<ul>

Help me in using javascript or jsp to do the above.. thanx in advance

<html>
  <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
        $("li").each(function(i) {
          alert($(this).attr("value"));
        });
      });
    </script>
  </head>
  <body>
    <ul>
      <li value="1">item 1</li>
      <li value="2">item 2</li>
      <li value="3">item 3</li>
    </ul>
  </body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.