The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Change Font through Java Script

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #241785

    Hi all,
    I’ve set onClick function in my javascript file.
    In which I am changing element

    text (paragraph) to another paragraph. It happens very well in English Text.
    Now I want to change the paragraph to the language other than English i.e. I want to display the paragraph to local language (MARATHI).
    I’ve embed require fonts, but it displays question marks (?????????) after I clicked the button.
    How to do this? Anybody help please.



    Are you using UTF-8?

    Without seeing it NOT working I’m not sure there is much we can do.

    GMK Hussain
        $( "#myButton" ).click(function(){
         $( "#myFont" ).css('font-family', "my font name here");

    I understand the script but without a demo (perhaps in and the actual font I’m not sure there is much we can do.


    This is my HTML

    text, which I want to change with local language text using onclick function

    HTML file :-

    Before showing any user supplied string in this way you should first check that it does not contain HTML markup, otherwise you may get security problems (XSS).

    <button id=”btn2″ onclick=”secondFunction()”>Click me!</button>

    JavaScript File –
    JavaScript Function:-

    function secondFunction() {
    document.getElementById(“two”).style.fontFamily = “shree_dev_otf_0708regular”;
    document.getElementById(“two”).innerHTML = ‘मराठी बोलणा-यांची एकूण लोकसंख्या ९,००,००,००० आहे. मराठी भाषा ९ व्या शतकापासून प्रचलित आहे.
    मराठी भाषेची निर्मिती संस्कृतमधून निर्माण झालेल्या महाराष्ट्री प्राकृत व अपभ्रंश या भाषांपासून झाली आहे. याउलट मराठी आणि काही अन्य भारतीय भाषांच्यावर
    संस्कार होऊन संस्कृत भाषा बनली असेही काही विद्वान मानतात. मराठी भाषा ही इसवी सनाच्या आधीही होती असे सिद्ध करण्याचा प्रयत्न प्रा. हरी नरके
    करित आहेत.’;


    As I said a DEMO is Codepen would be more use.


    I think you were on the right path Paulie;

    I just read this article

    The very second paragraph was [actually just a sentence]:
    “Did you ever get an email from your friends in Bulgaria with the subject line “???? ?????? ??? ????”?”

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.