Bump. I'm really looking for a solid tip here :). Thanks everyone.
On Apr 17, 9:48 am, kgosser <kgos...@gmail.com> wrote: > Here's a better example with HTML. See, I said it was hard to explain > in the first place :). > > Ok, so basically think of this as a list of things where the HTML is > always going to be the same, but there could be between 1 and N rows. > I'm trying to remove the onClick, and target just the link's class so > that when a specific link is licked, that specific row is removed. > > Here's some example HTML iterated: > > <div id="123"> > <h1>Example A</h1> > <a href="#remove" class="remove-link" onclick="removeDept > ('123','listA');return false;">Remove</a> > </div> > <div id="456"> > <h1>Example B</h1> > <a href="#remove" class="remove-link" onclick="remove > ('456','listB');return false;">Remove</a> > </div> > > I want to take out the onClick. So here's what I got in the > JavaScript: > > $(document).ready(function(){ > // consider the example "123" as the dynamic ROW_ID > // consider the example "listA" as the dynamic LIST_ID > $(".remove-link").click(function(){ > exampleAjaxFunction(ROW_ID,LIST_ID,function(){ > // call back if deleted from DB > $(this).parent().remove(); > }); > return false; > }); > > }); > > And so my question is..... I don't know how to pass ROW_ID and LIST_ID > to the single function like the onClick could.. Normally with just one > param to pass, I could grab it by targeting an <a>'s rel attribute. > But now there are TWO, and that's my point...There has to be a better > way to get those than just getting attributes, and that's what I'm > trying to figure out. > > Thanks for the help again everyone. > > On Apr 17, 12:15 am, "Michael Geary" <m...@mg.to> wrote: > > > I must be missing something obvious, but it sounds like you're not just > > working with some predetermined HTML, but you have the flexibility to tweak > > that HTML code, is that right? > > > Then why can't you generate this as part of your HTML page: > > > <script type="text/javascript"> > > // initialize some variables here > > </script> > > > That *is* HTML code, isn't it? > > > -Mike > > > > From: kgosser > > > > I have two values that are only found in a loop in the HTML. > > > They need to be passed to the single function in the document.ready(). > > > > I can't set them in the JavaScript. I have to "find" them > > > somehow in the HTML. Whether I find them as hidden inputs or > > > something, or as tags to the anchor, or as params passed in > > > somehow. I'm not sure what's best.