SyntaxError (code: 12; nsresult: 0x3053000c) possibly with $('#id option.select').text()
I've got a change handler in which the line 6 (t = $('#Club...)) seems to be causing a problem for which I would dearly appreciate assistance and/or advice. I believe this line to be the cause because the problem disappears when I remove it. With it in place, I get the first two alerts and then the error notice.
- clubSelectChangeHandler = function () {
- var v, t
- alert( '001 - Entering clubSelectChangeHandler')
- v = $('#ClubSelectRestrictor').val()
- alert( '002 - after v =')
- t = $('#ClubSelectRestrictor option:selected').text()
-
- alert( '003 - v= ' + v + '; t= ' + t + '.')
- /* various */
- }
I do need something like what that line should do for me (getting the text of the selected option), though I certainly do not insist that I get the text in precisely that way.
Interestingly, if I just tell firebug to continue, it does, and everything seems to be working just fine.
Jquery include (from earlier in this page):
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
The error code (full text a bit below) says it's on line 1275 of jquery-1.10.2.js, which is the line about newContext below:
- if ( newSelector ) {
- try {
- push.apply( results,
- newContext.querySelectorAll( newSelector )
- );
- return results;
- } catch(qsaError) {
- } finally {
- if ( !old ) {
- context.removeAttribute("id");
- }
- }
Here is the full text of the error as it shows in firebug.
[Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (SyntaxError)" location: "<unknown>"]
Line 1275
I got the idea to use this syntax (with option:selected) from the jQuery FAQs, so I suppose it ought to work. I'd be delighted to provide more detail if need be.