views:

54

answers:

3

In the below code:

var id=obj.setid({{info}});

I get an error saying illegal character and {{info}} has the following string:

"Website® is registered "

How do I handle this error in javascript?

Thanks..

Edit:

  setid looks like this
    setid: function (id)
                 {
                    var obj = $(this) ;
                     validate_id(id);
                 },
A: 

It looks like you're trying to set the id attribute of a DOM element to the value "website is registered", which is not a valid value for an id attribute.

Mike Sherov
+3  A: 
mystring = "Website® is registered";
alert(mystring);

Works just fine, it has nothing to do with the value of info -- the question is what do you think you're doing with {{info}}?

This is wrong if obj.setid is expecting a string or an object. The correct way would be:

// Wants a string
obj.setid(info);

// Wants an object
obj.setid({'text':info});

Hard to tell without knowing what obj.setid is

Erik
Thanks............................
Hulk
+1  A: 

Don't you need to put your string in quotes?

var id = obj.setid('{{info}}');

I can't tell from your post whether the "info" string has quotes in it already.

Pointy