QueryPath\DOMQuery::val PHP Method

val() public method

The 'value' attribute is common in HTML form elements. This is a convenience function for accessing the values. Since this is not common task on the server side, this method may be removed in future releases. (It is currently provided for jQuery compatibility.) If a value is provided in the params, then the value will be set for all matches. If no params are given, then the value of the first matched element will be returned. This may be NULL.
See also: attr()
Deprecation: Just use attr(). There's no reason to use this on the server.
public val ( string $value = null ) : mixed
$value string
return mixed Returns a DOMQuery if a string was passed in, and a string if no string was passed in. In the later case, an error will produce NULL.
    public function val($value = null)
    {
        if (isset($value)) {
            $this->attr('value', $value);
            return $this;
        }
        return $this->attr('value');
    }