Obtain value of an attribute of an object in javascript

0

I have an object that has an attribute formed by more attributes, something like this:

'.texto': {
        fill: 'black',
        ref: '.body', 'ref-x': 0.5, 'x-alignment': 'middle', 'ref-y': 55, 
        'y-alignment': 'middle',
        'text-anchor': 'middle',
        'font-weight': 'bold',
        'font-variant': 'small-caps',
        'text-transform': 'capitalize',
        'font-size': '14px',
        text : ''}

I would like to know how to get the value of "text" that is inside the ".text" attribute.

To obtain the value of an attribute I use the following expression:

"elemento".attributes.attrs["atributo"];

I've tried doing something like:

"elemento".attributes.attrs[".texto": {text}];

or

"elemento".attributes.attrs[".texto"/text}];

But I can not get the value, does anyone know how I can get the value of "text" ?.

Greetings and thanks.

Pd: I'm using the jquery and joint libraries.

    
asked by Manuel Bueno Mora 04.07.2018 в 13:34
source

1 answer

0

If I did not understand wrong, what you want is something like that, since you say it is in the DOM:

$('.texto').attr('text');
    
answered by 04.07.2018 в 19:01