Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Experts,

I have some div's following
HTML
<div id ="students"> 

<div class="photo" id="ef6a5118-5282-4930-bb21-4f825da20840"  önclick="GetDetailedItems(this,'T');">

<div> 2
<div> 3
<div> 4
<div> 5
</div>
</div></div></div></div>


I used
JavaScript
$('#students').html() 
to get the HTML Code contains divs.

I have get the code, but some characters become Encoded. Means I got the result like this...

HTML
<div class="photo" id="ef6a5118-5282-4930-bb21-4f825da20840"  önclick="GetDetailedItems(this,"T");">

<div> 2
<div> 3
<div> 4
<div> 5
</div>
</div></div></div>


Means In the On click function I have passed a variable "T" and when i got the out put, the sing quotes encoded to html entity..





PLease help me to get the actual result...

Thanks
Dileep
Posted
Updated 6-Jun-13 6:52am
v4
Comments
Christian Graus 6-Jun-13 12:40pm    
I see what the issue is, but why are you grabbing such a big block to deal with in jquery ? Why can't you grab the lower elements and work with the parts you need to work with ? If jquery is encoding this, then I don't see any way around it other than string mashing. What if you grabbed val() instead of html(), might that bypass the encoding ?
Ariana Bond 6-Jun-13 13:08pm    
I don't know why you are facing this problem as i have checked the same markup and jquery on my machine it is working as it should. Only thing which was missing is end tag for first div except that every thing is good.

Try this.
You can retrieve encoded html like below
C#
$('#students').html(value).text();

Hope this helps
 
Share this answer
 
Comments
dilzz 6-Jun-13 13:09pm    
here the "Value" means..?
Jameel VM 6-Jun-13 13:33pm    
value means the values need to be decoded.for example you can decode Hel&lo to Hel&lo
Refer - http://jsfiddle.net/taditdash/4S977/[^].

It is showing without any encoding.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900