[jQuery] Re: attr doesn't work in IE6 and Chromium

2009-08-11 Thread Liam Potter


wow... I'm not even sure what your are trying to achieve with thisno 
need for doing this through the onclick attribute, and I can't think why 
you are trying to set the onclick with some javascript?


Julijan Andjelic wrote:

script type=text/javascript
$(#sitemap a:eq(1)).attr(onclick,$('#sitemap a:eq(2)').text('');
sch('brands', '?echo $data[0][brand].');?).text( / ?echo $data
[0][brand];?);
$(#sitemap a:eq(2)).attr(onclick, $('#sitemap a:eq(1)').text('');
sch('categories', '?echo $data[0][category].');?).text( / ?
echo $data[0][category];?);
/script

This works perfectly in Firefox and Opera, but Chromium and IE6 only
change the text to value of $data[0][brand/category] (which is a
string) and seem to ignore the onclick attr, any ideas?
  




[jQuery] Re: attr doesn't work in IE6 and Chromium

2009-08-11 Thread Stephan Beal

On Aug 11, 5:35 pm, Julijan Andjelic julijan.andje...@gmail.com
wrote:
 script type=text/javascript
 $(#sitemap a:eq(1)).attr(onclick,$('#sitemap a:eq(2)').text('');

have you tried:

$(#sitemap a:eq(1)).click();

?

that is the canonical way to add an onclick handler in jquery.