Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:44:45+00:00 2026-06-07T10:44:45+00:00

I am trying to add a navigation bar on top and because i will

  • 0

I am trying to add a navigation bar on top and because i will lots of separate html file, i want to keep the navigation in one file, so incase i make changes it changes in all the pages. If i enter the code in the page itself it works just fine but when its in an external file it gives a different view.

The Jquery snippet is:

var snippet =   '   <div id="topMainNav">' +
    '   <ul>' +
    '       <li class="mainNav">' +
    '           <a href="" class="navlink">Find a Doctor</a>' +
    '       </li>' +
    '       <li class="mainNav">' +
    '           <a href="" class="navlink">Why Interfaith</a>' +
            '               <div class="dropdown" id="dropdown_one">' +
    '               <div class="subMainNav" style="padding: 10px;">History & Mission</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Executive Director</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Locations & Directions</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Service Centers</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Career Opportunities</div>' +
    '               <div class="subMainNav" style="padding: 10px;">News & Events</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Parking</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Places To Stay</div>' +
    '           </div>' +
    '       </li>' +
    '       <li class="mainNav">' +
    '           <a href="" class="navlink">Medical Services</a>' +
    '           <div class="dropdown" id="dropdown_two">' +
    '               <div class="subMainNav" style="padding: 10px;"><a href="#">Behavioral Health</a></div>' +
    '               <div class="subMainNav" style="padding: 10px;">Clinical Laboratory</div>' +          
    '               <div class="subMainNav" style="padding: 10px;">Dentistry</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Emergency</div>' +      
    '               <div class="subMainNav" style="padding: 10px;">Gynecology</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Medicine</div>' +         
    '               <div class="subMainNav" style="padding: 10px;">Pastoral</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Pediatrics</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Physical Medicine & Rehab</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Radiology</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Surgery</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Other Services</div>' +
    '           </div>' +
    '       </li>' +
    '       <li class="mainNav">' +
    '           <a href="" class="navlink">Medical Trainings</a>' +
    '           <div class="dropdown" id="dropdown_three">' +
    '               <div class="subMainNav" style="padding: 10px;">Medical Training</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Behavioral Health</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Predoctoral Externship</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Podiatric Residency</div>' +          
    '               <div class="subMainNav" style="padding: 10px;">Dental Residency</div>' +
    '               <div class="subMainNav" style="padding: 10px;">Pulmonary Residency</div>' +
    '           </div>' +
    '       </li>' +
    '       <li class="mainNav">' +
    '           <a href="" class="navlink">For Patients & Visitors</a>' +
    '           <div class="dropdown" id="dropdown_four">' +
    '               <p><a href="#">This is a Link</a></p>' +
    '               <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin blandit sodales justo, id fringilla eros dapibus vitae. Morbi molestie enim diam, a vulputate neque. Morbi sit amet nunc.</p>' +
    '           </div>' +
    '       </li>' +
    '       <li class="mainNav">' +
    '           <a href="" class="navlink">Contact Us</a>' +
    '       </li>' +
    '   </ul>' +
    '</div>';

$(function(){$('.writeNav').append (snippet);});

on my HTML page i have the following:

calling the external jscript file:
<script type="text/javascript" src="theScriptsStyles/miscScripts.js"></script>

and in the body of the html i have this:

<div class="writeNav"></div>

What its suppose to do is, have a pull down menu, so as i put my mouse over it has a slide down menu which is not working. Anyone can please tell me what i am doing wrong.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:44:46+00:00Added an answer on June 7, 2026 at 10:44 am

    I think ,your script is getting loaded even before the div is created. That is why it is not able to find and element with that Class./ Check if that is the case

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to remotely add links to the site top navigation bar. It
I am trying to add a little animation with jQuery to my navigation bar.
I'm trying to add a reload button to my navigation bar using this code
I want to add a image just above the navigation bar. Here is the
I am trying to add two right buttons to the navigation bar. I tried
I'm trying to disable a button that I add to my navigation controller bar.
I am trying to add a navigation component with a button bar in it
I am trying to add a refresh button to the top bar of a
I have a navigation bar coded in html & css, and I am trying
I'm trying to add 2 buttons to a UINavigationController's navigation-bar: 1) the standard back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.