0

Im trying to run some javascript but I'm getting the following error: missing ) after argument list. I'm wondering can anyone tell me where I'm going wrong.

$('<div id=dojoUnique1 class='dojoDndItem filterName' style=padding:.5em;display:inline-block;width:16em;overflow:hidden;vertical-align:bottom;>filter_info_ALL_DATA_DOWN</div>').appendTo('#selectedFilters');
1
  • Just a note: filter_info_ALL_DATA_DOWN looks like a variable, if so you need to concatenate this in your string using the + - operator Commented Mar 19, 2015 at 10:25

3 Answers 3

1

you are using simple quotes twice in a row... escape quotes:

"$('<div id=dojoUnique1 class=\"dojoDndItem filterName\" style=padding:.5em;display:inline-block;width:16em;overflow:hidden;vertical-align:bottom;>filter_info_ALL_DATA_DOWN</div>').appendTo('#selectedFilters');"
Sign up to request clarification or add additional context in comments.

2 Comments

if you use double quotes inside single quotes, there is no need to escape them. Furthermore the qoutes around style are missing
yes i know but he edit his post to remove the wrapping double quotes.. so yes indeed, no need to escape
1

You have mis-matched ' delimiting your string. If you use an editor with syntax highlighting errors like this are easy to spot. Try this:

$('<div id="dojoUnique1" class="dojoDndItem filterName" style="padding: .5em; display: inline-block; width: 16em; overflow: hidden; vertical-align: bottom;">filter_info_ALL_DATA_DOWN</div>').appendTo('#selectedFilters');

Comments

1

You should create elements using jQuery, which is lot safer that quotes mess and more maintainable.

Here is an example

$('<div />')
    .prop('id', 'dojoUnique1')
    .addClass('dojoDndItem filterName')
    .css({
        "padding" : "0.5em",
        "display" : "inline-block"
    })
    .html("filter_info_ALL_DATA_DOWN")
    .appendTo('#selectedFilters');

1 Comment

Is it possible to use these elements in selenium webdriver scripts?

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.