-1

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;
    break;

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

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 https://student.fsb.hr/~pi201247/diy

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
wingman
  • 25
  • 6

2 Answers2

0

You need to include JQuery in a script tag in your document.

Feathercrown
  • 2,547
  • 1
  • 16
  • 30
0

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

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Oh yeah, I totally forgot about putting that in... I was fiddling with js for 3 hours trying to get it to work. Thank you! – wingman May 04 '16 at 14:02