When sending form, page stuck in transaction and raise error in console:
Uncaught Error: Syntax error, unrecognized expression: :nth-child jquery-1.8.2.min.js:2
I figured out where the problem is.
It happens when there is not any list item in navbar, so following code will break jquery mobile:
[div data-role="navbar"][ul] [/ul]
(Editor didnt allow me to post html here so I changed tags)
Seems this old bug have came back #1107
You can call the navbar plugin to enhance the navbar after you appended the list items. Without list items there is nothing to enhance yet, so you can leave out data-role="navbar". That data- attribute is only used to auto initialize the navbar plugin. Example: http://jsbin.com/ikisux/35/edit
However, it should also be possible to enhance the navbar by using trigger("create"). In that case you do need to set data-role="navbar" and the issue you reported occurs. Test page: http://jsbin.com/ikisux/36/edit
Related issue: #4990
The error only occurs with jQuery core 1.8.x, because of changes in Sizzle. It's not a regression because with one list item there is no issue and that's what #1107 was about. The reason the issue wasn't noticeable before was in fact a bug in Sizzle.
Use tripple backticks to add code blocks to your post. See http://github.github.com/github-flavored-markdown/
This one caught me when I managed to close my ul incorrectly - I used <ul>instead of </ul> to (incorrectly) close the list. The browser (chrome) happily closed BOTH ul elements, leaving the second one emtpy (without <li> elements) and so triggering the above bug. This was a pretty subtle typo, so thought I'd share the experience in case some else is looking at this and saying to themselves (like I did) "but I've got <li> elments in my list!!!!" :)
this worked for me after upgrading to query 1.8.2 and getting the nth child error with jquery mobile
"You can call the navbar plugin to enhance the navbar after you appended the list items. Without list items there is nothing to enhance yet, so you can leave out data-role="navbar". That data- attribute is only used to auto initialize the navbar plugin. Example: http://jsbin.com/ikisux/35/edit"
I just checked for existence of data, and if there was not any, did not place the navbar in my page.
Had this error with div data-role="navbar" containing empty ul list (i.e. no li's)
inserted check for 0 children in $.fn.grid at 5556 (1.3.0-rc.1)
if ( $kids.length == 0 )
seemed to fix the problem.
Closing as duplicate of #6337.