0

I have visited this and this but they are quite different from my approach. I am creating a widget for sisense using javascript.

MyWidget.js

render: function (widget, args) {
  console.log("My calendar widget");

  var element = $(args.element);
  element.empty();

  var myText='<p>hello</p>';  <----------I WANT TO REPLACE THIS WITH HTML FILE

  // Add to the DOM
  element.append(myText);
}

And the HTML file is styler.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Date Picker</title>
</head>
<body>
    <h1>CUSTOM<span>DATE</span>PICKER</h1>
    <div class="date-picker">
        <div class="selected-date"></div>
        <div class="dates">
            <div class="month">
                <div class="arrows prev-mth">&lt;</div>
                <div class="mth"></div>
                <div class="arrows next-mth">&gt;</div>
            </div>
            <div class="days"></div>
        </div>
    </div>
</body>
</html>

I am new in javascript. Please tell me how to do it. I'm not sure Is it even possible or not.

I also tried doing with a string:

var myText='<h1>CUSTOM<span>DATE</span>PICKERs</h1>'
                        +'<div class=date-picker></div>'
    +'<div class=selected-date></div>';
    +   '<div class=dates>'
    +       '<div class=month>'
    +           '<div class=arrows prev-mth>&lt;'
    +           '</div>'
    +           '<div class=mth>'
    +           '</div>'
    +           '<div class="arrows next-mth">&gt;'
    +           '</div>'
    +       '</div>'
    +   '<div class=days>'
    +   '</div>'
    +   '</div>'
    +'</div>';
Tanzeel
  • 4,174
  • 13
  • 57
  • 110

0 Answers0