Ajisha
Ajisha

Reputation: 423

illegal character in jquery/java Script

I have problem with function parameter which i have passed.

function SearchContact([email protected],John Smith,12345678)
{
....code here-...
}

when see in firebug/console, It give me error that is

SyntaxError: illegal character

for more clarity please see in pictureenter image description here

please give me solution. Thank you in advance.

Upvotes: 0

Views: 89

Answers (3)

Paul Fitzgerald
Paul Fitzgerald

Reputation: 12129

You should define the function like this

function SearchContact(email, name, number)
{
....code here-...
}

You then need invoke the function like this.

SearchContact('[email protected]','John Smith', 12345678);

if you want to invoke the function on the click of a button you should do something like this:

<button onclick="SearchContact('[email protected]','John Smith', 12345678)>

Upvotes: 0

helgeheldre
helgeheldre

Reputation: 1101

You need to wrap your text in quotes. In addition if your code example is taken directly from your code you need to alter your parameter names from [email protected] to "email"

Upvotes: 0

brk
brk

Reputation: 50346

You need to pass the function parameter in this way

function SearchContact(email,name,value)
{
....code here-...
}

Call the function by passing actual values

SearchContent('[email protected]','John Smith',12345678)

Upvotes: 1

Related Questions