Hello.
I have a function which replaces one object with a "stand-in" object. It has the same alias, but different display verbs.
Here is the code I'm using to switch the object's hyperlinks to handle the stand-in:
JS.eval ("$('.elementmenu').each(function(){if($(this).attr('data-elementid') == '"+this.name+"'){$(this).attr('data-elementid','"+this.standin.name+"').attr('data-verbs','Look at/Dismount');} });")
This changes the data-elementid attribute for each link, but not the data-verbs attribute.
I can change each element's id attribute, and that works, too. It's just the data-verbs.
Is Quest binding each jjmenu to the link as they are created (or something)?
Screenshot:
Nice one. Little inefficient though, I think?
Might be better to do something like:
JS.eval ("$(\".elementmenu[data-elementid='"+this.name+"']\").html('"+link+"');")
Not 100% sure on that.
(You can use $("[attributename='attributevalue']")
as a selector; as far as I'm aware, it'll work for any attribute you can access with .attr()
. Whether the attributevalue needs quotes seems to be a little wobbly, but I figure it's best to include them. You can also use ^=
for "starts with", and I think it's $=
and *=
for "ends with" and "contains" string comparisons respectively)