SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery filters anyone?

    I have some form fields which are named in such a way as to be submitted as an array, thus:

    <input type="text" name="my_fields[]" />
    <input type="text" name="my_fields[]" />
    <input type="text" name="my_fields[]" />
    etc.

    I am trying to access these fields using jQuery:
    $('#myform').find('input').filter('[name=my_fields[]]');

    Unfortunately this seems to ignore the filter completely because of the square brackets. I have tried escaping them with back-slashes, but to no avail.

    Any ideas?

  2. #2
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have not used jQuery filters but in XSL the following xpath query works fine
    /input[@name='my_fields[]']

    I am not sure but try this
    $('#myform').find('input').filter('[name="my_fields[]"]'
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vikrantkorde View Post
    I have not used jQuery filters but in XSL the following xpath query works fine
    /input[@name='my_fields[]']

    I am not sure but try this
    $('#myform').find('input').filter('[name="my_fields[]"]'
    That seems to have done the trick. Cheers.


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
  •