TrevDroid
TrevDroid

Reputation: 85

Missing ) after argument list Javascript Jquery

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');

Upvotes: 0

Views: 39

Answers (3)

Satpal
Satpal

Reputation: 133403

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');

Upvotes: 1

Rory McCrossan
Rory McCrossan

Reputation: 337560

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');

Upvotes: 1

bln
bln

Reputation: 320

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');"

Upvotes: 1

Related Questions