Reputation: 18200
I'm trying to get what's inside a <div>
with ID of display
using
$("#display").after(html);
var testxd = $("#display").text();
window.location.replace("test.php?v="+testxd);
and all I get is a BLANK. I Help?
Here is div display
:
<div id="display" style="display: none;"></div>
I know the ID is in the because the ID shows up during after(html)
;
Upvotes: 2
Views: 1604
Reputation: 385114
I think you meant append
, not after
. You're adding content after #display
, not into it.
This means that your <div>
in fact remains empty, so of course .text()
returns an empty string.
Upvotes: 0
Reputation: 35477
There is no text inside the <div id="display"></div>
so blank is the result.
If you had
<div id="display">foo</div>
then you would get "foo" from $("#display").text();
Upvotes: 2