www.webdeveloper.com
Results 1 to 3 of 3

Thread: trying to re-write NOT using jQuery..

  1. #1
    Join Date
    Mar 2010
    Posts
    281

    trying to re-write NOT using jQuery..

    How can i re-write this function without using jQuery?, i.e., plain old javascript?

    It's an input type="button" (not submit) with an id of 'view-portfolio'. It could be a
    hyperlink instead of course, but it's a grouped together with some other form buttons and it needs to like identical.

    the jQ is simply this -

    PHP Code:
    $(document).ready(function() {
        $(
    '#view-portfolio').click(function() { window.location='newpage.php' });
    }); 
    i'm familiar with getElementById['view-portfolio'], but get stuck at that point.

    thanks for any help on this..

  2. #2
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,265
    The simplest method has to be
    Code:
    document.getElementById['view-portfolio'].onclick=function(){window.location='newpage.php'}
    But, there is other methods with addEventListener or attachEvent (See, for example, this page)

  3. #3
    Join Date
    Mar 2010
    Posts
    281
    thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles