2

I am getting the error missing ) after argument list in my Firebug console.

I can't understand why. The problem is with the text that is passed in as an argument to the before() method. I am pretty sure it's something to do with the quotation marks. I have tried doing \" and \' instead of ' but neither was successful, they gave different errors.

As long as I can add the HTML that is within the before() method I don't mind how I solve this.

$(document).ready( 
        function () {
        $("#add").click( 
             function () {
             $("#add").before("<s:text name='queries[0].property' class='small-text' size='28'/><span class='small-text'> = </span>");

        });
    });
5
  • 2
    That code seems to be working on it's own: jsfiddle.net/shanethehat/aNgSM Commented Jul 30, 2011 at 10:26
  • I would bet on a Firebug bug. Commented Jul 30, 2011 at 10:30
  • 1
    Thanks, yes it does. I am trying to figure it out. I have a feeling it's to do with the Stripes s: prefix. Commented Jul 30, 2011 at 10:44
  • @ring0 actually the content never shows up, so it's causing an issue in my app as well. Commented Jul 30, 2011 at 10:44
  • Looks like the JS is ok, so it must be something to do with Stripes. Commented Jul 30, 2011 at 10:47

3 Answers 3

4

There is nothing wrong with the code that you show, so you probably have got some unprintable character in the string that keeps it from working.

Try to copy the string and past it back, or if that doesn't fix it, retype the string.

Sign up to request clarification or add additional context in comments.

2 Comments

I've been trying that kind of thing for hours :)
@Ankur: Then scale it up. Create a new file, and copy pieces of code into it until you find which code it is that causes the error message.
1

Looks like you are using jQuery. I'd bet the missing ')' is something to do with your document.ready, looks unbalanced.

Try doing it like this:

$(function(){
        $("#add").click(function(){
             $("#add").before("<s:text name='queries[0].property' class='small-text' size='28'/><span class='small-text'> = </span>");
        });
});

It's the same as document.ready, just a shortcut but I use it all the time. Think this should be ok.

Hope it helps

EDIT:

Oops I missed that string :)

I'd also try out JK's answer, that looks good to me.

Comments

0

I think you have to escape some characters, because the HTML parser interprets a </ sequence as the end of a script. So try to use <\/ instead:

$(document).ready(
    function () {
    $("#add").click( 
         function () {
             $("#add").before("<s:text name='queries[0].property' class='small-text' size='28'/><span class='small-text'> = <\/span>");
        });
    });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.