Set Dynamic HTML Attributes: x-bind
Learn to dynamically bind the result of JavaScript expressions to HTML attributes.
We'll cover the following
The x-bind
directive allows us to set HTML attributes with the result of JavaScript expressions. The syntax for x-bind
takes the form x-bind:[attribute]='Attribute value'
, where [attribute]
is the HTML attribute we want to dynamically bind Attribute value
to.
The example below shows how to set the value
attribute of an input
element:
Get hands-on with 1200+ tech skills courses.