prop attr jquery difference

In the following example we will check the basic difference between attributes and properties in JQuery.
In the page we can see an input with id example and an element a with id my_link that will allow us to create a link:

  • We select the input with id example and get the value of the attribute and property value.
  • We select the input with id example and with the function val we set another value for the input. With attr and prop we obtain the value of the attribute and value property.
  • We select the link creator with id my_link and get the value of the attribute and property href.
  • We select the link creator with id my_link and get the value of the attribute and property target.
Comments

PHP Captcha


Interesting Articles