Skip to content

Instantly share code, notes, and snippets.

@Joseph7451797
Last active July 21, 2017 15:06
Show Gist options
  • Save Joseph7451797/ce5b575ef18133df7dabb62583db8bf1 to your computer and use it in GitHub Desktop.
Save Joseph7451797/ce5b575ef18133df7dabb62583db8bf1 to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/pakota
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script id="jsbin-javascript">
var str = '<div class="alice">123</div>'; // HTML string
var d = document.createElement('div'); // create HTML div
d.innerHTML = str;
var t = $(d).find('.alice');
console.log(t.text());
</script>
<script id="jsbin-source-javascript" type="text/javascript">var str = '<div class="alice">123</div>'; // HTML string
var d = document.createElement('div'); // create HTML div
d.innerHTML = str;
var t = $(d).find('.alice');
console.log(t.text()); // will log 123</script></body>
</html>
var str = '<div class="alice">123</div>'; // HTML string
var d = document.createElement('div'); // create HTML div
d.innerHTML = str;
var t = $(d).find('.alice');
console.log(t.text()); // will log 123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment