wingman wingman - 2 years ago 143
HTML Question

Combining jQuery and normal JS

Basically what I want to do is load some text from a .txt and stuff it inside a paragraph. I'm still in a phase of experimentation so what's happening is I have 2 buttons that load text into a paragraph. Both work from within the same javascript with a switch case.

case '6':
vidljivo.innerHTML = slova.innerHTML;

case '7':
$("#paragra").load( "1.txt" );

The first one (case 6) loads text from a hidden div on the page, but since that's clunky I want to put the data on an external document. That's what the other button should do (case 7) but when I click on it I get an error saying $ is not defined. Not sure what I'm doing wrong so any idea is appreciated.

You can see both the script and the page and all at

Answer Source

You can't use functions provided by the jQuery library without using a <script> element to load the jQuery library (available from )

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download