var myString = ""; $("#container .item").each(function(i){ myString = myString + "," + this.id; });
$("#myInput").val(myString); Hope this helps. Glen On 7/8/07, rockerzocker <[EMAIL PROTECTED]> wrote:
First of all many thanks to the makers for this absolutly fantastic library. I just discovere jquery and I'm really carried away by its ease of use and its small size. However, as I slowly get a grip on how it works, i still couldn't figure out, whether there is a function in jquery which returns only the ID's of selected elements, rather than the entire html mark up. Example: <div id="container"> <div class="item" id="1">item1</div> <div class="item" id="3">item2</div> <div class="item" id="3">item3</div> </div> <input type="text" id="myInput" name="myInput"/> Given this markup, how would i get only the id's of all elements with the class="item", e.g. path them as comma separated values to the input field ? As a bloody beginner I would welcome any hint. Thanks, Daniel