javascript - button in jquery and jscript -


i trying understand difference between jquery , javascript. , apologies if silly question.

this attempt @ jquery. on pressing button text in <p> should change requested. cannot work. http://jsfiddle.net/qahda/7/

this javascript attempt. cannot work either http://jsfiddle.net/alhb8/1/

can please me

  1. my jquery above working.
  2. my jscript above working.
  3. i trying point write jquery in such way written in javascript. can me this?

thanks

edit

thanks answers/corrections: looking part 3 enter link description here part 1 using javascript,i think. in future should careful,using left hand pane, include jquery library , make sure jsript wrapped in head/body

jquery

you need include jquery library page selecting jquery version in first dropdown in left panel

demo: fiddle

js sample

the problem since function defined within onload callback, not available in global scope causing error saying

uncaught referenceerror: myfunction not defined

the solution add script body elements, instead of inside onload callback selecting no wrap - in <body> in second dropdown in left panel

function myfunction() { alert("hello world!"); } 

demo: fiddle


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -