This works fine for me (using jQuery 1.3): $(function(){ $('<div>').attr('id','test').html('div html').appendTo ('body'); // inject html element, also works fine hard-coded. $('#test').attr('ryantest','hithere'); $('a').click(function(event){ event.preventDefault(); alert($('#test').attr('ryantest')); }); });
Alerts 'hithere' when you click a link. On Feb 9, 10:28 am, Tom Shafer <tom.sha...@gmail.com> wrote: > Does the attr feature let me capture my own attribute inside a > element. I am trying and it doesnt seem to be working. I just > wondering if there was a way to do this. > > Thanks > > -Tom