JQuery :: Passing A Variable To A Selector: Syntax Error
Jul 13, 2011
I'm passing a variable to a selector. I have found a few resources and tried to implement them but they're just not working for me. I am trying to find href that match my variable and am working with the following:
var itemLink = /site/Mario-Kart..etc.
$("a[href=" + itemLink + "]").......etc.
I receive an error "Uncaught Syntax Error unrecognized expression: [href=/site/Mario-Kart..etc. ]" I have been placing the quotes in different places to correct the syntax but to no avail. Also, this works with JQuery v1.44 and earlier but not after.
i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:
i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]
I have a simple jquery selector: $('[id^=total_item]') I would like to add a rule so that the upper code would match all elements that don't have 'locked' class (so that it wouldnt match those with class='locked'). How should I add this rule to the selector?
I'm receiving the following error: Error: uncaught exception: Syntax error, unrecognized expression: # However all the functionality of the script continues to work, I need to get rid of the error as it looks pretty bad on client's sites and want to make sure the script isnt doing anything funny. The basic set up is a number of Select boxes, When selecting an option in the select boxes, I loop through a JSON stock array to see if the item is in stock and to then enable / disable the relevant options in the other selects based on the stock record. The error (as far as I can see) appears on this line: $("#option" + nextid + " option").filter(function(){
IM NEW AT THIS AND I'M WORKING ON MY FIRST WEBSITE. I USED iWED AND I DON'T UNDERSTAND WHY IT WON'T WORK. WHENEVER I TRY TO OPEN IT IT SAYS: Parse error: syntax error, unexpected T_STRING in /home/a2460084/public_html/beto/index.html on line 1
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">[code].....
I keep getting a syntax error on line 3 and 4 of this very simple script. Normally firebug would give me enough info to fix this but jQuery escapes me. I can see no reason for the errors. <script type="text/javascript"> $(".shipping-switch[name='shipping_switch']").click(function(){ var selector = "div#sub-address"; if($(this).val() === "1"){ $(selector).slideDown("fast"); } else { $(selector).slideUp("fast"); }}); </script>
This is my first post to the group, so please be gentle :) For some unknown (to me at least) reason I'm getting a syntax error in IE from the following code
I am trying to create a javascript library in Lotus Notes , I am pasting in the jquery code into my library but it will not compile. Is this a jQuery syntax error or Lotus Notes error you think? I get the same problem with the 1.4.2 release of jQuery.
Lots of submenus and such, and just can't get this going. Works fine if I remove the submenu aspects of the script, however with these, it returns the error: uncaught exception: Syntax error, unrecognized expression: #
I'm not actually sure that this issue was developed as I upgraded to jQuery 1.5, but it was very much around that time. I packaged my testcase and attatched it to the post. The fallowing error is caught in the JavaScript console when the Öppna Alla button is pressed on the site:
Is there any such thing as a jQuery Debugger, i'm trying to learn jQuery but even small things like Syntax errors keep getting in the way and it's hard to track down without any error reporting.
I want to load an html div in a variable, modify it in another variable; and then change the document injecting the contents.
1. I load the html to be changed in a variable (code) 2. I modify an attribute of <param> using attr() and I put the result in a var (newcode) 3. I change the html in the doc
I've used the debugger, and all steps give the expected results, except of newcode.html(), which is a null string. Why?
I have this JavaScript that is supposed to show random products from my database, and show something different every time you refresh or revisit. But I keep getting an error - on my computer - that says Syntax Error in Line 2.
There is no error on most other computers, and the products show, but another script on the page, an article title scroller, stops - on most computers, but not all. It says "no articles available".
I've tried the script on an asp page and a htm page, all by itself, but it still doesn't work. I tried changing all kinds of settings in my browsers, but nothing helps. I'm on XP, SP2, which I've heard has some problems handling javascripts. I don't know if that's true, but if it is, I know that lots of other people will have the same problem as me when they view the page. Actually, I think it is a good thing, that my computer is pointing out this error. I get the error message in IE6, but in NS8 and FF, I just don't see the products. No error message.
Anyway, here are the first three lines of the script:
<% if TRIM(request.servervariables("http_referer")) = "" then %>
Using spellcheck, I found that referer is spelled wrong, it should be referrer. I don't know if that is right for javascript (or asp?), but correcting it didn't make a difference.
The script is JavaScript on an asp page, and it is called in an htm page.
Sorry but I can't get the very first tutorial to work. I put the custom.js in a test_jr directory in htdocs. I also put the starterkit.html file in the same directory. I copied the contents of jquery-1.4.4.min.js into a jquery.js file also in the same directory. Then I did the custom.js page shown here:
I tried clicking on the [URL] and I get the starterkit.html page. If I click on the "some link" it doesn't do anything. What am I missing? There are syntax errors in my editor starting on the line with the asterisks* Why is there an error there? It looks like it closes the click function?
$('#prov_1 .toggleEdit').click(function () { $('#prov_1 .editable').toggle(); }); When I click on the "toggleEdit" button under #prov_1, the .editable elements in #prov_1 appear/disappear. Now I want to do this for all prov_N. $('#prov_' + pid + ' .toggleEdit').click(function () { $('#prov_' + pid + ' .editable').toggle(); });
does not work. How do I extract or define N, the pid number?
I'm unable to find solution for dreamweaver reporting syntax error with the following page:
[URL]
I am revamping my website so the css is not set up for this page but that's okay. I have put in the various javascripts based on the product so the page is similar to a template. The syntax error is for the second set of boxes, the bracelet length options, and specifically for line with:
form.amount.value = 6.5 inches; from the following script-- <SCRIPT language=javascript> function BraceletLength(form) {
I have the below code and it works fine except the part where I need to access data.Picture. I know its a syntax error but I can't seem to understand what.