gargl icon indicating copy to clipboard operation
gargl copied to clipboard

Get attribute value

Open Err0r404 opened this issue 10 years ago • 1 comments

Hi,

I'm using Gargl and it's awesome ! However I have a question : is there any way to get attribute value of an element ?

For exemple get the "href" value ?

Thanks !

Err0r404 avatar Mar 23 '14 11:03 Err0r404

Hi,

We don't currently support having anything other than innerHTML of an element returned for a response field.

The correct behavior should be to return the innerHTML for a response field that is not of type input or textarea. For input or textarea return the value property instead. We should also have an attribute capability that lets you say instead of the innerHTML or value, you want the value of a certain attribute of an element returned for a response field. But we don't support any of this right now. Feel free to submit a pull request supporting this functionality :)

The workaround would be to provide the css selector for the parent of the element you want the attribute value for, and then parse this parent's innerHTML for the attribute of the child element you're looking for.

jodoglevy avatar Mar 23 '14 19:03 jodoglevy