SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    opening a dialog on click

    hi folks,
    i am new at JS and jQuery. so i had this dialog
    Code JavaScript:
    <script>
        $(function() {
            $("#dialog" ).dialog({autoOpen:false})
            $('#tos').click(function() {
                $('#dialog').dialog('open');
            });
        });
    </script>
    and when i click on link. it doesn't open
    Code HTML4Strict:
    <a href="#" onclick="tos">Terms of Services |</a>
    where am i going wrong?
    All those who wander aren't lost.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    The script is attaching the onclick to the tag with id="tos"

    you don't need any onclick= in the HTML as you already have it in the JavaScript.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •