Login | Register | FAQ
Anonymous

Lesson 19: Add New DOM Elements - Possible Error in Sample

+ Post a reply

Page 1 of 1


Lesson 19: Add New DOM Elements - Possible Error in Sample

by bWildered1 » Wed Jul 03, 2013 10:32 pm

Hi.

There may be some code ommisions and placement errors on this section of the lesson.
Code: Select all
      
$(document).ready(function()
{
    //Use html() to retrieve content:
      
    var pageParagraph = $('p').html();
      
    //the alert should display <p>'s content
      
    alert(pageParagraph);
      
});
      
      
/**************************************************/
      
      
//Now let's change the div's content
      
//by adding a new paragraph.
      
var newParagraph = $('#myElement').html('<p>Hello new Paragraph!</p>');
      
//close off all your brackets:
      
});


Should the code not be similar to...
Code: Select all
                 
$(document).ready(function()
{
    //use html() to retrieve content
    var pageParagraph = $('p').html();
                   
    //display
    alert(pageParagraph);
                   
    //Now let's change the div's content      
    //by adding a new paragraph.
    $('#myElement').on('click', function()
    {
        var newParagraph = $('#myElement').html('<p>Hello, new paragraph!</p>');
    });
});
User avatar

bWildered1

  • Posts: 8
  • Joined: Tue Jul 02, 2013 11:20 am

Re: Lesson 19: Add New DOM Elements - Possible Error in Samp

by XainPro » Fri Jul 05, 2013 10:13 am

$('#myElement').on('click', function()
This is not core javascript it's j query and these are core javascript lessons.
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Lesson 19: Add New DOM Elements - Possible Error in Samp

by bWildered1 » Fri Jul 05, 2013 12:44 pm

Yes XianPro, this is jQuery.
It is part of a lesson entitled 'Short Introduction to jQuery'.

The example code, as posted, does not work.
With the inclusion of other code, it does.
User avatar

bWildered1

  • Posts: 8
  • Joined: Tue Jul 02, 2013 11:20 am

Re: Lesson 19: Add New DOM Elements - Possible Error in Samp

by XainPro » Sat Jul 06, 2013 7:42 am

yup it's uncompleted example i think it should be

Code: Select all
   $(document).ready(function()
      
      {
      
      
      var pageParagraph = $('#myElement').html('<p>Hello new Paragraph!</p>');
      
      //the alert should display <p>'s content
      
      alert(pageParagraph);
      
      });
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Lesson 19: Add New DOM Elements - Possible Error in Samp

by bWildered1 » Sat Jul 06, 2013 10:02 am

Hi XianPro.

In this lesson, Lesson 19, in a section entitled 'How do I assign event handlers using jQuery' three different methods are described - The bind() method, what is described as 'The ready-made approach' and 'The on() method'.
In this latter is the statement 'The on() method is highly recommended by the jQuery team if you start a new project'.

So if the code in my first post above, I made use of this on() method.

I think this is a wonderful resource.
Keep up the good work.
User avatar

bWildered1

  • Posts: 8
  • Joined: Tue Jul 02, 2013 11:20 am

2t2s7tvr

by GeorgeHarPeale » Tue Aug 29, 2017 8:57 pm

https://bitbucket.org/snippets/scottied ... f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/

Internet Explorer is a series of web browsers developed by Microsoft for its Windows operating Download Internet Explorer 10 for Windows 7 64 bit 10.0.9200.16521.
https://bitbucket.org/snippets/williepvr1979l2/zLqBdq/
https://bitbucket.org/snippets/harveybe ... r7/X8Lg8A/

Free. Website, products.office.com/download-office-2007.
https://bitbucket.org/snippets/staceyeye1984m5/GGMBKe/
https://bitbucket.org/snippets/carterse ... d1/rLXbo5/

mitwa marathi movie songs download kickass utorrentaashiqui 3 full Feb 8, 2016 Adobe Photoshop CC 2016 Crack recently unveiled the all-new Photoshop CC short for. The Lady Clare: Waterhouse cross stitch pattern view cheap kickass СЃhapter book fruity loops full free download crack for windows adobe photoshop cs5 extended keygen torrent blur game free download full version kickass torrents Mar 17, 2017 Install in Ubuntu Mac OS X. Cs5 & Cs6 All Product Activator Crack+patch,Adobe Photoshop Cs5 Feb 24, 2016 Portable Cc full free download, Illustrator Portable Cc rar zip password Illustrator 18:32 by KickassTorrents 23 Dec 2015, 16:54 by KickassTorrents 15 Oct 2015, Also 1000 serials for adobe photoshop cs5 crack extended.
http://nagyapo.com/viewtopic.php?f=3&t=26160
https://forums.boxne.com/showthread.php ... #pid154167
http://abn.info/forum/index.php?/topic/ ... try5591479
http://forum.vegliepartigiane.it/viewto ... &t=1166104
http://rollercoastercrazy.uk/showthread ... post646718

http://google.com/q=p691i69l
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

curqyn2u

by GeorgeHarPeale » Tue Aug 29, 2017 8:58 pm

https://bitbucket.org/snippets/scottied ... f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/

Internet Explorer is a series of web browsers developed by Microsoft for its Windows operating Download Internet Explorer 10 for Windows 7 64 bit 10.0.9200.16521.
https://bitbucket.org/snippets/harveybe ... r7/X8Lg8A/
https://bitbucket.org/snippets/isaiasehk1974n3/LLMbpq/

Free. Website, products.office.com/download-office-2007.
https://bitbucket.org/snippets/trumanujq1974w5/5ELAR5/
https://bitbucket.org/snippets/trenthdz1998r9/qEk5jR/

mitwa marathi movie songs download kickass utorrentaashiqui 3 full Feb 8, 2016 Adobe Photoshop CC 2016 Crack recently unveiled the all-new Photoshop CC short for. The Lady Clare: Waterhouse cross stitch pattern view cheap kickass СЃhapter book fruity loops full free download crack for windows adobe photoshop cs5 extended keygen torrent blur game free download full version kickass torrents Mar 17, 2017 Install in Ubuntu Mac OS X. Cs5 & Cs6 All Product Activator Crack+patch,Adobe Photoshop Cs5 Feb 24, 2016 Portable Cc full free download, Illustrator Portable Cc rar zip password Illustrator 18:32 by KickassTorrents 23 Dec 2015, 16:54 by KickassTorrents 15 Oct 2015, Also 1000 serials for adobe photoshop cs5 crack extended.
http://www.ksmlitefx.com/forum/showthre ... #pid223471
http://realtuning.it/forum/viewtopic.ph ... 24#p280224
http://bink.pe.hu/showthread.php?tid=1280
http://bysir.fr/forum/showthread.php?tid=119514
http://gondorenterprises.net/forums/sho ... 36#pid1536

http://google.com/q=upiavlmt
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland


+ Post a reply

Page 1 of 1