Here is an actual example. Would anyone know why this isn't working? What I find weird is if I do a single line ( alert($("span").attr ("printElement")); ) it works fine. But if I try to use the each() function following it, nothing happens.
Any help would be great. Thanks! HTML: <span printElement="this is for the first item">This is the first span 1</span><br /> <span printElement="so is this one">This is the first span 2</ span><br /> <span>This is the first span 3</span><br /> <span printElement="Another item in here">This is the first span 4</ span><br /> <span>This is the first span 5</span><br /> <span printElement="asdf asdf af awe">This is the first span 6</ span><br /> <span printElement="hello!">This is the first span 7</span><br /> <span printElement="World">This is the first span 8</span><br /> <span>This is the first span 9</span><br /><br /> Output:<br /> <div id="output"></div> Javascript: $(document).ready(function() { //alert($("span").attr("printElement")); $("span").each(function() { $(this).attr("printElement").each(function() { }); }); } On May 4, 1:33 pm, Andy H <adharb...@gmail.com> wrote: > For some reason this post disappeared. Can anyone answer this? > > Thanks! > > On May 1, 10:01 am, Andy <adharb...@gmail.com> wrote: > > > > > This is an odd questions. I have a huge form with a lot of data. > > There is a table that data in it I need to display on a print screen > > (of course this data isn't being displayed in the regular table). So, > > I put the display text in a span tag. > > > So, this is how each item will look: > > > <span printData="Item 1 detail to display">Item 1</span> > > <span printData="item 2 detail to display">Item 2</span> > > > I need a way to grab all spans on the page that have the attributte of > > "printData" and grab that text inside that attribute and print it out. > > > Any thoughts?- Hide quoted text - > > - Show quoted text -