The CreatorCon Call for Content is officially open! Get started here.

missing name after . operator

James Michaels1
Giga Expert

I'm trying to set up a UI page in SNow and am receiving the error "missing name after . operator" when trying to save. I've included the code that it is referencing as the problem below but can include all of it if that seems necessary. The spot that is specifically referenced is line 7 column 98. This code works properly outside of SNow so I'm assuming it is caused by how SNow interprets the JavaScript. I've done some digging and came up with the idea that I am using a reserved word but changing out ui for testVar came up with the same error so I'm not sure what the reserved word might be. Any help is appreciated.

//when element is dragged to #chosen

$( "#chosen" ).sortable({

        receive: function( event, ui ) {

                  //iterate through the snowIssuesArray

                  for (i=0;i < snowIssuesArray.length;i++){

                            //find the match

                          if (snowIssuesArray[i][0] == ui.item[0].innerHTML && snowIssuesArray[i][1] == ui.item[0].class){

                                      //and remove it

                                      snowIssuesArray.remove(i);

                            }

                  }

        }

});

1 ACCEPTED SOLUTION

Geoffrey2
ServiceNow Employee
ServiceNow Employee

class is the reserved word.   You need to change class to something else.


View solution in original post

6 REPLIES 6

It's not just ServiceNow.   That is the whole point of reserved words. If you want the class attribute then use .getAttribute()


ui.item[0].getAttribute('class')


DOM Element getAttribute() Method


Thank you for the help. I guess the browser I was using might just have been more fault tolerant then it should have. I'll make sure to avoid that in the future.