sachin
sachin

Reputation: 93

Hindi Content are not displaying through JQuery

I am trying to display some Hindi words using JQuery because these are the common content which should be display on each page of the web site. Note - This is a static website only. Using HTML and JQuery/javascript.

My JS file is below - include.js

$(document).ready(function(){
        var text="<div class='header-main'>मुख्य पृष्ठ कुछ हिंदी के शब्द </div>";                  

$(".header__fixed").html(text);                        
});

my html file is - index.html

<body>
 <header class="header header__fixed">

</header>
</body>

But it is displaying something like -

????????? in the header div. Please help me to solve this problem.

enter image description here

Here is the screen shot of the error when i am saving the .js file. Please help me to get out this problem. I already included the in my html file.

Upvotes: 1

Views: 1452

Answers (3)

sachin
sachin

Reputation: 93

I got the answer of my problem... It is so simple.. Just save the file with Unicode character set. I am using dreamweaver and have changes the character type by saving as file.

<html encoding="UTF-8" charset="UTF-8">

Upvotes: 0

Himesh Aadeshara
Himesh Aadeshara

Reputation: 2121

hi first off all you need to add this two things in to html tag encoding="UTF-8" charset="UTF-8" like..

<html encoding="UTF-8" charset="UTF-8">

and yes the second is the main thing that you need to save this html with Encoding in UTF-8 option this will make hindi characters available try this by creating example locally this will run

Upvotes: 0

Jacob
Jacob

Reputation: 1395

Add <meta charset="utf-8"> to the <head> of your HTML.

Upvotes: 1

Related Questions