Library - JQuery

Back to Course

Lesson Description

Lession - #567 JQuery Set

The attr(>
method sets or returns attributes and values of the selected components. when this method is used to return the attribute value, it returns the value of the first matched component.

Set content methods
Sets or returns the text content of selected components

Sets or returns the content of selected components (including html markup>

Sets or returns the value of form fields


 <title> jQuery Example</title>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">  
{ $("#btn1">
{ $("#test1">
.text("Hello world!">
; }>
; $("#btn2">
{ $("#test2">
.html("Hello world!">
; }>
; $("#btn3">
{ $("#test3">
; }>
; }>
; </script> </head> <body> <p id="test1">This is a set text.</p> <p id="test2">This is set html.</p> <p>Set value: <input type="text" id="test3" value="learning"></p> <button id="btn1">Set Text</button> <button id="btn2">Set HTML</button> <button id="btn3">Set Value</button> </body> </html>
Try it here