Set attribute and property jQuery value

We will check how attributes and properties work in JQuery.

In the web we can see an input with id example and an element a with id my_link with a link.

  • We select the id my_link and save in a url variable the value of the attribute. Then we display it.
  • We select the id my_link and set the attribute target="_blank" so that the link is returned in a new page.
  • The input with id example we apply the attributes type text and value Mike. We show the value of its attribute and property, and the existing type with attr and prop.
  • To the input with id example we change the attribute value to John and we show its result with attr and prop.
  • To the input with id example we change its value to Nothing and we show its result with attr and prop.
Comments

PHP Captcha


Interesting Articles