How to decode HTML entities using jQuery

0 votes
How do I use jQuery to decode HTML entities in a string? Is it possible?
Sep 2, 2020 in Java-Script by kartik
• 37,510 points
6,940 views

1 answer to this question.

0 votes

Hello @kartik,

To encode:

$("<textarea/>").html('<a>').html();      // return '&lt;a&gt'

To decode:

$("<textarea/>").html('&lt;a&gt').val()   // return '<a>'

Hope it helps!!

Thank you!!

answered Sep 2, 2020 by Niroj
• 82,880 points

Related Questions In Java-Script

0 votes
1 answer

How to select and manipulate CSS pseudo-elements such as ::before and ::after using jQuery?

Hii @kartik, Here is the way to access ...READ MORE

answered May 18, 2020 in Java-Script by Niroj
• 82,880 points
6,072 views
0 votes
3 answers
0 votes
1 answer

How to send data in request body with a GET when using jQuery $.ajax()?

Hello @kartik, Sending the data in your scenario,I ...READ MORE

answered Jun 18, 2020 in Java-Script by Niroj
• 82,880 points
18,106 views
0 votes
1 answer

How to convert HTML to JSON using PHP?

Hello @kartik, If you are able to obtain ...READ MORE

answered Jun 19, 2020 in Java-Script by Niroj
• 82,880 points
7,063 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
21,896 views
0 votes
1 answer

What is type casting and type juggling in php?

Hey, The way by which PHP can assign ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
6,834 views
0 votes
2 answers

How can we create a session in PHP?

Hello, niroj. Here is my idea session_start(); $_SESSION['USERNAME'] ...READ MORE

answered Dec 7, 2020 in PHP by Famous
• 140 points
932 views
0 votes
1 answer

What is the use of $_REQUEST variable in php?

Hii @kartik, The $_REQUEST variable is used to read the ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
2,814 views
0 votes
1 answer

How to create HTML elements using jQuery?

Hello @kartik,  if you're doing $('<div>'), jQuery will also ...READ MORE

answered Sep 18, 2020 in Java-Script by Niroj
• 82,880 points
803 views
0 votes
1 answer

How to Abort Ajax requests using jQuery?

Hello kartik, Just use ajax.abort(). For example you could ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,880 points
8,744 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP