3

I'm rather a noob to JavaScript and jQuery, so I need some help. WIthin my app, I've implemented a DatePicker calendar, loaded through an external js, and it works perfectly fine. I want to implement a jQuery button which can catch the date, i.e: 3rd of August, and fetch me a wikipedia page www.wikipedia.org/August_3. I also want this page to be uploaded to an iframe below. How can I do that in jquery? Here are the simpliefied versions of the html and the js respectively.

<head>
    <script src=".../jquery.ui.button.js" type="text/javascript">
    <script src=".../jquery.ui.datepicker.js" type="text/javascript">
</head>
<body>
    <script src="/.../myscript.js" type="text/javascript">
    <div class="demo">
        <p>Date: <input id="datepicker" type="text"></p>
    </div>
    <script>
    $(document).ready(function()
    {
          $( "#datepicker" ).datepicker();
    });
    </script>
Jose Faeti
  • 12,126
  • 5
  • 38
  • 52
user823148
  • 147
  • 2
  • 14
  • Please format your post correctly, add code tags, remove non esential non printable characters. – marto Aug 03 '11 at 14:38
  • 1
    1. Learn JS. 2. Try to implement it. 3. Ask specific questions when you have a specific problem. – Quentin Aug 03 '11 at 14:38
  • 3
    This is more of a request than a question. You requesting someone to build all the functionality for you. Try this [peopleperhour.com](http://www.peopleperhour.com/). But seriously, you say you're new to jQuery, try doing this yourself and learn, it will benefit you in the future – Alex Aug 03 '11 at 14:40

2 Answers2

7

I'm rather a noob to javascript and jquery, so I need some help.

Starter

Mozilla JavaScript Guide

jQuery DOCs

jQuery tutorials

Advanced

Mozilla JavaScript DOCs

ECMA 5 DOCs

Douglas Crockford JavaScript

JavaScript best practices

Quirks Mode

Books

Recommended JavaScript books

Tools

JS Lint to check for bad written code

JS Fiddle to try out your scripts or piece of code

AVOID!

jQuery pitfalls to avoid

w3schools Check http://w3fools.com/

Personal advice

Remember jQuery is a library written in JavaScript, everything jQuery does can be done with plain JavaScript. Using a library such as jQuery is a good thing, because it will ensure cross-browser compatibility, has a large community, you need to write less code, and so on... but please don't abuse it. You can do simple tasks with JavaScript, avoiding useless function calls and slow scripts.

Community
  • 1
  • 1
Jose Faeti
  • 12,126
  • 5
  • 38
  • 52
2

How can I do that in jquery?

Something like this:

$(document).ready(function()
{
    $( "#datepicker" ).datepicker()
        .bind(
            'dateSelected',
            function(e, selectedDate, $td)
            {
                Date.format = 'yyyymmdd';
                var dateStr = selectedDate.asString();
                $('#myIframe').attr('src', 'http://www.wikipedia.com/' + dateStr);
            }
    );
});

Read up on the DatePicker docs and this.

Mike Thomsen
  • 36,828
  • 10
  • 60
  • 83