jquery not selecting option tags when value contains space

Do I need to somehow escape a space when using jquery to select with contains/find? I am mocking this up so pardon the typos... If I have a SELECT tag that has some options I am trying to find the options in this select using jquery. but it appears that the "find" method or "contains" function fails when the value being passed to search for contains a space. For example: The following returns a size of 2: $('*[title="animals"]').find("option:contains('Dog')").size() But this returns 0 whre I would expect 2 as well: $('*[title="animals"]').find("option:contains('Dog B')").size() My guess is that this has something to do with the selector and it is looking for a child element with "B" or something but Im not really sure.
Was a bug in 1.2.6 version of jquery, workgin fine on 1.3.2...Sorry :)

以上就是jquery not selecting option tags when value contains space的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准