Q:

Write a jQuery Code to get a single element from a selection

0

Write a jQuery Code to get a single element from a selection.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>Write a jQuery Code to get a single element from a selection</title>
</head>
<body>
<ui>
  <li>Html Tutorial</li>
  <li>Mongodb Tutorial</li>
  <li>Python Tutorial</li>
</body>
</html>

JavaScript Code :

var listItems = $( 'li' );
var rawListItem = listItems[1]; // or listItems.get(0)
var html = rawListItem.innerHTML;
console.log(html);

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now