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

121
Views
Toggle buttons issue

If I click on search icon it will open back button and search bar. Again I click on the back button it will open search icon

I tried with inner html.

If I click on search icon I used innerhtml to display back button and search bar. But if I click on back button how to render search icon?

container.insertAdjacentHTML('afterbegin', `
  <header>
    <div id="chat-icon">
      <div class="search"><i class="fas fa-search"></i></div>
      <div id="chat"><i class="far fa-edit"></i></div>
    </div>
  </header>
  <div id="group-list"></div>`);

container.querySelector('header #chat-icon #chat').addEventListener('click', async() => {
  this.chat.container.querySelector('.groups').remove();
  this.chat.container.insertAdjacentElement('afterbegin', this.createGroup.container);
  await this.createGroup.load();
});

container.querySelector('header .search').addEventListener('click', async() => {
  this.chat.container.querySelector('header .search').innerHTML = `
    <div class="heading">
      <div id="back-button"><i class="fa fa-arrow-left"></i></div>
      <div id="search-bar"></div>   
    </div>`
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of .remove() and .load(), you can use .hide to hide the searchbar and .show() to show it.

about 4 years ago · Juan Pablo Isaza 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!