SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JQuery automation to mimic user iteration of web page

    Hi there.

    I wish to automate the population of a page by prefilling form values such as select boxes as well as fire off the change event after the value has been set. However there are at least 3/4 select boxes on one page which need populating automatically.

    This works fine for the first element but not for subsequent elements all in one go when use the Trigger method of Jquery.

    Can anyone suggest where I am going wrong.

    e.g.

    $('#category').val(5);
    $('#category').trigger('change'); <-- stops here.
    $('#unit').val(8);
    $('#unit').trigger('change');

    The change event on category seems to break the flow and does not pass control back to carry on the order of processing.

    Thanks.

    Phil.

  2. #2
    SitePoint Enthusiast Anthony.Barnes's Avatar
    Join Date
    Aug 2011
    Location
    Canberra, Australia
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps it's throwing an error you haven't noticed. The logic seems to work fine:

    Quick test:
    http://jsfiddle.net/QMPQD/1/


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
  •