Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
JS - dates in array, link building

I'm looking for a way to add a working link to the eventName. If I add a link directly in the code, it will be displayed as text, not as link. Do I have to write a completely new function here or is somewhere simple trick enough? I will be grateful for your response.

!function () {
    var data = [
        {eventName: '<a href="#">EventName</a>', calendar: 'Work', color: 'orange', eventTime: moment("2021-12-22")},
        {eventName: '<a href="#">EventName</a>', calendar: 'Work', color: 'orange', eventTime: moment("2021-12-02")},
        {eventName: '<a href="#">EventName</a>', calendar: 'Other', color: 'green', eventTime: moment("2021-12-09")}
    ];
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You are creating the event as a span, so it just prints out the anchor tag as text

On your Calendar.prototype.renderEvents function, you should create an anchor tag and set its href

var a = createElement("a", "", ev.eventName);
a.href = "#";

Instead of

var span = createElement("span", "", ev.eventName);
about 4 years ago · Santiago Trujillo Report

0

Right around line 303 you have this:

  var span = createElement('span', '', ev.eventName);

The default behavior of that 3rd argument is to set it's content as text element. You can force it to render the content as HTML with this additional line.

  var span = createElement('span', '');
  span.innerHTML= ev.eventName;

Example: https://codepen.io/javacado/pen/bGoogYg?editors=1111

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!