Move all elements with class inside div

I’m brand new to js, and tried to move every elements with certain class inside a certain div.
I made some research and saw a solution that works with id, but when I tried to change it to classNames it didn’t work anymore.
Is there anything more to write ?

Here is my HTML

<div class="bottom">bottom 1</div>
<div class="bottom">bottom 2</div>
<div id="top">top</div>

and my script so far

document.getElementById('top').appendChild(document.getElementsByClassName('bottom'))
console.log(document.getElementById('top').innerHTML)

I understood that appendChild didn’t work because document.getElementsByClassName(‘bottom’) is an array string instead of a node, but I have absolutely no idea what a node is, neither how to change my code for it to work.

I would really appreciate any help at all !
Thanks.

Can we access single javascript object from two nodejs files [closed]

tester.mjs:

var instance = null;
export default class tester {
  constructor() {
   this.name = null;
  }
  static getInstance(){
    if(!instance){
      console.log("Creating instance")
      instance = new tester();
    }
    return instance;
  }
  
  setName(name) {
   this.name = name
  }
  
  getName() {
   return this.name
  }
}

file1.mjs:

import tester from './tester';
var obj = tester.getInstance();
obj.setName("seetha")

file2.mjs:

import tester from './tester';
var obj1 = tester.getInstance();
console.log(obj1.getName())

I am trying to set the name from file1.mjs and get the name from file2.mjs.First I run file1.mjs then it creates one javascript object for tester.mjs.Second I run file2.mjs then it again creating new javascript object for tester.mjs.But I want to use single javascript object of tester in both file1.mjs,file2.mjs and I want to run file1.mjs and file2.mjs independently.
Can anyone suggest me to achieve this.

How to smooth scrolling when clicking an japanese anchor link

My anchor link generated automatically:

<a class="" href="#Heading_3" title=">Heading 3</a>
<a class="" href="#%E3%81%A8%E3%80%81%E3%82%B2%E3" title=">ゲゲームのフ</a>

and anchor to

<h4><span class="" id="Heading_3"></span>Heading 3<span class=""></span></h4>
<h4><span class="" id="#%E3%81%A8%E3%80%81%E3%82%B2%E3"></span>ゲゲームのフ<span class=""></span></h4>

I use Javascrip & JQuery to smooth scrolling.

$('a[href^="#"]').on('click', function (e) {
    e.preventDefault();

    var target = this.hash;
    var $target = $(target);

    $('html, body').stop().animate({
        'scrollTop': $target.offset().top
    }, 900, 'swing', function () {
        window.location.hash = target;
    });
});

So, only heading 3 working ok, but link Japanese not working. How to scroll to link have Japanese smoothly?

Problem with button activation with v-slot activator

I’m using v-slot:activator with v-btn in my Vuejs project. it works fine but the button stays hovered as if it was pressed

       <v-dialog v-model="dialog" max-width="600px">
        <template v-slot:activator="{ on, attrs }">
          <v-btn color="#F65C38" dark class="mt-1 mr-2" width="209px" v-on="on" v-bind="attrs"> Example Btn </v-btn>
        </template>
        <v-card>
          <v-card-title>
            <span class="text-h5">{{ formTitle }}</span>
          </v-card-title>

          <v-card-text>
            <v-form ref="form" v-model="valid">
              <v-container>
                <v-row>
                 

                  
               
           
                </v-row>
              </v-container>
            </v-form>
          </v-card-text>

          <v-card-actions class="d-flex justify-center">
            <v-btn color="#f66037" plain @click="close" elevation="4" dark width="209" class="mb-6"> No </v-btn>
            <v-btn color="#F65C38" @click="save" dark width="209" class="mb-6"> save </v-btn>
          </v-card-actions>
        </v-card>
      </v-dialog>

data:

dialog: false

watch:

  dialog(val) {
      val || this.close();
    },

method:

    close() {
  this.dialog = false;
  this.$nextTick(() => {
    this.editedItem = Object.assign({}, this.defaultItem);
    this.editedIndex = -1;
  });

before click
enter image description here

after clickenter image description here

Want to same attribute on multiple place in moongoose

{
    username:{
        type: String,
        max: 12,
        min: 4,
        default: "Instagram User"
    },
    userId:{
        type: String,
        unique: true
    },
    email:{
        type: String,
        unique:true
    },
    password:{
        type: String,
        min:6,
        select: false
    },
    dob:{
        type: String,
        required: true
    },
    profilePic:{
        type:String,
        default:"/image/avatar.jpg"
    },
    follower:[{
        followerId:{
            type:String,
        },
        followerName:{
            type:String,
        },
        followerPic:{
            type:String,
        }
    }],
    following:[{

        followingId:{
            type:String,
            default: "__I want same objectId here__"
        },
        followingName:{
            type:String,
            default:"**Same username here**"
        },
        followingPic:{
            type:String,
            default:"**same profile pic here**"
        }
    }],
    
}

@if condition not working in scss when passing dynamic value from html?

In my html file i am passing value for –is-item-status as :-

<ion-label class="textColor label-md black-shade-light" style="--is-item-status: {{item.status}}" >{{item.status | formatEnum | async}}</ion-label>

(Note:- this is populated inside *ngFor condition).

in the browser i am able to see the value getting populated as :-

element.style{ --is-item-status: INVOICE_OPEN }

In my scss file i have code like :-

.textColor {
  @if var(--is-item-status) ==  'INVOICE_OPEN' {
    color: blue;
  } @else if var(--is-item-status) == ('PAYMENT_STATUS_CANCELLED'  or 'INVOICE_CANCELLED' or 'ORDER_CANCELLED') {
    color: red;
  } @else if var(--is-item-status) == ('PAYMENT_STATUS_PARTLY_APPLIED' or 'INVOICE_PARTLY_PAID' or 'ORDER_CLOSED') {
    color: black;
  } @else if var(--is-item-status) == ('PAYMENT_STATUS_APPLIED' or 'INVOICE_PARTLY_PAID' or 'ORDER_INVOICED') {
    color: green;
  }  @else {
    color: yellow;
  }
}

But the if conditions are not getting satisfied. Could someone tell me what am i doing wrong in this ?

Find path of object property, recursively

I want to print path of object key, dynamically. Here is my code:

   const Tree = ({ data }) => {
     let path = "onboarding";
  
      return Object.keys(data).map((key) => {
        if (Array.isArray(data[key])) {
          path = path + "." + key;
          return (
              <Tree data={data[key]}></Tree> 
          );
        }

        if (typeof data[key] === "object") {
          path = path + "." + key;
          return (
              <Tree data={data[key]}></Tree>
          );
        } else {
          path = path + "." + key;    
          return (
            <input defaultValue={data[key]}
              style={{ fontWeight: "bold" }}
              disabled={!this.props.isEditable}/>

          );
        }
      });
    };

and its my data

  onboarding: {
    enumType: 1,
    key: "key1",
    steps: [
      {
        title: "STEP ONE",
        description: "des1",
        instructions: [
          {
            icon: "step_power",
            label: {
              text: "text1",
              color: "A11111",
              location: "top",
            },
          },
        ],
      },
      {
        title: "STEP TWO",
        description: "des2",
        instructions: [
          {
            icon: "step_power",
            label: {
              text: "text2",
              color: "A11111",
              location: "top",
            },
          },
       ],
    }

And i want to print path of key for each iteration, expected output :

  • “onboarding.enumType”
  • “onboarding.key”
  • “onbording.steps”
  • “onboarding.steps[0]”
  • “onboarding.steps[0].title”
  • . . .
  • “onboarding.steps[1].instructions[0].label.location”

unexpected identifier while compiling ejs

I get the titled error when trying to compile the following

<table>
        <tr >
          <th>First Name</th>
          <th>E-mail</th>
          <th>Last LogIn</th>
        </tr>
        <% for(var i=0; i < users.length; i++) { %>
            <tr>
                <td><%= users[i].name.trim() %></td>
                <td><%= users[i].email.trim() %></td>
                <% if users[i].lastLogIn.trim() !== null %>
                <td><%= users[i].lastLogIn.trim() %></td>
                <% else %>
                <td><0></td>
                <% endif %>
            </tr>
            <% } %>
    </table>

can i get help please

Counting animation Not displaying decimal values

This is the code i have used, i am getting an issue that its not displaying decimal values
i.e : if i give the value 4.5 , it displays only 4, please help me with the problem

$('.count').each(function () {
$(this).prop('Counter', 0).animate({
    Counter: $(this).text()
}, {
        duration: 8000,
        easing: 'swing',
        step: function (now) {
            // $(this).text(Math.ceil(now));
            $(this).text(Math.ceil(now).toString().replace(/(d)(?=(ddd)+(?!d))/g, "$1,"));
        }
    });

});