Extension to Get Name or ID of an Object Being Clicked On / Dragged


(Alex Steele) #1

I have searched the forums but I cannot find what I am looking for, perhaps someone could point me in the right direction?

I would like to capture the name / ID of the Element that was just clicked on or is currently dragged and assign this to a variable, and of course then be able to modify and work with the element that is clicked on in the same manner as typical while referencing the variable


(Jonathan Deutsch) #2

If you assign a Run JavaScript… action and make the javascript, you’ll see the code for the empty function is:

// element - DOMHTMLElement that triggered this function being called
// event - event that triggered this function being called
function untitledFunction(hypeDocument, element, event) {

}

Note the element is an argument passed in. This is a DOM element, so if you want to get the ID, you can get it via element.id. IDs are automatically assigned to all elements, but you can override the ID and class name in the Identity Inspector if you want a custom one.

The Display Name of the element is not exported.


(Alex Steele) #3

Thank you!