473,466 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Trouble with javascript and bootstrap

3 New Member
Hey guys, I'm having trouble using the jQuery .click function on a navigation bar made using bootstrap. Here is the code

Expand|Select|Wrap|Line Numbers
  1. <div class="navbar navbar-inverse navbar-fixed-top navbar-wrapper" role="navigation" id="bar-1">
  2.  <div class="container">
  3.   <div class="navbar-header">
  4.     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".collapse">
  5.       <span class="sr-only">Toggle navigation</span>
  6.       <span class="icon-bar"></span>
  7.       <span class="icon-bar"></span>
  8.       <span class="icon-bar"></span>
  9.     </button>
  10.     <a class="navbar-brand" href="index.html">Project</a>
  11.   </div>
  12.   <div class="collapse navbar-collapse">
  13.     <ul class="nav navbar-nav navbar-left">
  14.       <li class="active"><a href="index.html">Home</a></li>
  15.       <li><a href="#about">Current Courses</a></li>
  16.       <li class="dropdown">
  17.       <a href="#" class="dropdown-toggle" data-toggle="dropdown">Projects<b class="caret"></b></a>
  18.       <ul class="dropdown-menu">
  19.        <li><a href="#" id="sudoku1">Sudoku</a></li>
  20.        <li><a href="#" id="huffman">Huffman</a></li>
  21.        <li><a href="#" id="spantree">Spantree</a></li>
  22.        <li><a href="#" id="calendar">Calendar</a></li>
  23.        <li><a href="#" id="snake">Snake</a></li>
  24.        </ul>
  25.       </li>
  26.       <li><a href="#Resume">Resume</a></li>
  27.         <li><a href="#contact" data-toggle="modal">Contact</a></li>
  28.       </ul>
  29.   </div><!--/.nav-collapse -->
  30.  </div>
  31. </div>
  32.  
and here is a simple onclick jquery
Expand|Select|Wrap|Line Numbers
  1. $('#snake').click(function(){alert("Works!");});
  2.  
Apr 20 '14 #1
2 1564
Dormilich
8,658 Recognized Expert Moderator Expert
and what trouble do you have?
Apr 20 '14 #2
zifu
1 New Member
Not sure what your problem is, it works as expected: http://jsfiddle.net/V9CfA/1/
May 14 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: vetolimits | last post by:
Hi everyone, Machine info: Fedora Core 3, MySQL-server-4.1.9, and perl-DBD-MySQL-2.9003-5 When I try to use mysqlhotcopy command to backup database, following error occurs :(& ...
2
by: Jeremy Ames | last post by:
I saw a post on here with in the past week or so, but I cannot seem to find it now. It had something to do with loading the .Net framework bootstrap to the msi installation. Can someone please help?
25
by: acemtp | last post by:
Hello, I would like to show you a new collaborative website for javascript programmer. It's quite hard to know if some specific code you wrote will work on all browsers, and if not, why it...
0
by: | last post by:
Greetings. In an effort to get python2.4 on my Centos 3.7, I installed the python bootstrap rpm. This installed 2.4 alongside 2.2 and updated yum to 2.4.0. Oddly, it didn't create a symlink...
0
by: bootstrap | last post by:
www.bootstraptech.com Bootstrap Technologies Private Limited, Global Systems integration and IT Services Company with a Focus on Enterprise Applications Space looking for Aggressive offshore...
4
by: Aaron Gray | last post by:
I am after opend source small, middle or large example programs thay use MVC pattern coded Javascript. Many thanks in advance, Aaron
4
by: Berco Beute | last post by:
I wonder what it would take to implement Python in JavaScript so it can run on those fancy new JavaScript VM's such as Chrome's V8 or Firefox' tracemonkey. Much the same as Python implementations...
0
by: atencorps | last post by:
Hello I have the following code but need some help on it. The idea of the code is the main sections ie Service Management are viewable when the page is loaded and by clicking on the main...
1
by: neovantage | last post by:
Hi, I am trying to implement Bootstrap Scrollspy in my content page but unable to do that. I also used Affix in that code which is working perfectly fine. I used the ethics advised by bootstrap but...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.