This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Having Problems with Jquery.

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

its been a while since I used jquery so I am trying to do a simple thing that when you click a button it pops up an alert box.

I have this




When I press the button nothing runs.
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael,

I have copied and pasted your code and it runs fine for me in IE, Firefox and Opera.

Are you sure you have the jquery-1.3.1.min.js as pointed to in your head, or do you have the normal jquery-1.3.1.js?

That's all I can think of really

Cheers

Joe Lemmer
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are calling the code before the element is rendered. You need to either use dom ready or put the code after the button.

Eric
 
Michael Hubele
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Lemmer wrote:Hi Michael,

I have copied and pasted your code and it runs fine for me in IE, Firefox and Opera.

Are you sure you have the jquery-1.3.1.min.js as pointed to in your head, or do you have the normal jquery-1.3.1.js?

That's all I can think of really

Cheers

Joe Lemmer



I think I figured out the problem. I have that intellsense file and it is so picky. If you have the jquery script before the intellsense file at run time I don't know what happen it does not work. If you move the file up so the intellisense file is above the jquery script it works.

I don't remember it every being that pick before.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Pascarello wrote:You are calling the code before the element is rendered.

Actually he's not. The code is in a jQuery ready handler.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jQuery itself is a good on-page citizen, making sure that it doesn't clobber other libraries (even going so far as to have a mechanism to relinquish the $ name to other libraries).

Other libraries are generally not so friendly about sharing the page.
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic