473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Trouble with javascript and bootstrap

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 1559
Dormilich
8,658 Expert Mod 8TB
and what trouble do you have?
Apr 20 '14 #2
zifu
1
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.