Skip to main content

yo(selector).attr()

yo(selector).attr(property)

Get the property value of the selector

// get the property src from .myclass
var prop = yo('.myclass').attr('src');

yo(selector).attr(property, value)

Set the property value into the selector;

// set the value '/image.png' to property 'src'
yo('.myclass').attr('src', '/image.png');

yo(selector).attr(property, value, convertHtmlEntity)

If the value "convertHtmlEntity" is set to "true" then Yaj will try convert the html entity values into the proper value in the current code page

// The example below will set 'fé' in the input value; 
yo('input').attr('value', 'fé')

// But this example will set 'fé' in the input value;
yo('input').attr('value', 'oká', true)

Go to index