Welcome aboard! We are happy you are here and wish you good net-raft!
<!doctype html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<button class="button1">create id</button></p>
<button class="button2">show id</button></p>
<div>Hello net-raft.com!</div>
<script>
$(document).ready(function () {
$(".button1").click(function () {
var str = $("div").attr('id', 'newID');
alert("created!");
});
$(".button2").click(function () {
var str = $("div").attr('id');
var str1 = $('#newID').text();
alert(str + ': ' + str1);
});
});
</script>
</body>
</html>
The most helpful JQUERY solutions