SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot w1nk5's Avatar
    Join Date
    Aug 2009
    Location
    Ontario, Canada
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prototype to jQuery

    Prototype:
    var reportId = event.findElement('tr').identify().match(/\d+/);

    jQuery:
    var reportId = $(this).closest('tr').attr('id').is(/\d+/);

    You can see what I have above. However, in prototype reportId = the closest tr element with an id of digits. In jQuery it returns false.

    I realize the .is() returns true or false, my questions is... what can I do to replicate the what Prototype performs.

    Thanks

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by w1nk5 View Post
    I realize the .is() returns true or false, my questions is... what can I do to replicate the what Prototype performs.
    There's something else here that's going to prevent a solution from properly being applied, and that is that it's not allowed for any identifier to start with a number.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot w1nk5's Avatar
    Join Date
    Aug 2009
    Location
    Ontario, Canada
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    There's something else here that's going to prevent a solution from properly being applied, and that is that it's not allowed for any identifier to start with a number.
    Well the prototype code works. I am converting all prototype to jquery. I think I phrased that wrong, its not looking for an id of digits, it is looking for the closest id with digits, not necessarily all digits.

  4. #4
    SitePoint Zealot w1nk5's Avatar
    Join Date
    Aug 2009
    Location
    Ontario, Canada
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind. I figured it out. I should have just left .match(/\d+/) and not changed it.

    Thanks


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
  •