PDA

View Full Version : Replace attribute of element



cofin
4 Jun 2009, 9:00 AM
I have a page where I want to dynamically find and replace the href on certain elements.

I can easily do this in jQuery like so:


$("a[href='javascript:doSubmit('T_MY PROFILE');']").attr('href', 'http://www.test.com/');The above code will find any 'a' elements with an href of 'javascript:doSubmit('T_MY PROFILE');' and replace with 'http://www.test.com'.

What is the easiest method to do this in ExtJS/Ext Core?

I believe that I'm managed to select the proper element:

Ext.select("a[href='javascript:doSubmit('T_HOME');']");But I'm a bit confused on where I go from here.

hendricd
4 Jun 2009, 9:14 AM
Ext.select("a[href='javascript:doSubmit('T_HOME');']" [,true]).set(...);

cofin
4 Jun 2009, 10:34 AM
Thanks! That definitely helped me get to where I need to go. I was very close to begin with...

This is what I came up with and it seems to work just fine:


Ext.select("a[href='javascript:doSubmit('T_HOME');']",true).set({href: "f?p=1000:1:"
+ $v('SESSION')
+ "::"
+ $v('DEBUG')
+ "::::"});