I'm new to JavaScript and can not find this little thing to work on. (All external scripts have been loaded in a definite way)
I have this jQuery script:
$ ('a.link'). Click (function () {autoComp ('city');}); Function Auto Comp (Storm Names) {var company = 'Adobe apple Microsoft' split (""); Var city = 'London Paris Berlin' '. (""); $ ('#' + StrFormName) Autocomplete (strFormName)}
I can not do it for the work I've found that the problem is after the last "strFormName". Autocomplete
I appreciate the help I can get.
You are going to autocomplete with the actual code strFormName
Probably want to do this instead:
function autocomp (strFormName) {var data = {company: 'Adobe Apple Microsoft' split (""), city: 'London Paris Berlin' split Do ("")}; $ ('#' + StrFormName) .autocomplete (data [strFormName]); }
What does an object ( data ) do with two properties,
city
and company
. After that, when the array passes on the orcompiler, it selects the appropriate array by looking at the property by name using the syntax for the []
syntax.
Properties. For example, all of these retrieve the You can get this idea, you can either use the name in the code by its name literally, or by listing it in the object with I might have pulled out city
from the data :
var x = data.City; Var x = Data ['city']; Var y = "city"; Var x = Data [OR]; Var x = Data ["C" + 'I' + "T" + 'Y'];
[]
Can and give property as a string (which can be literally string, or a string that is coming from the result of a variable, or expression, or function, or ...). data from
automatically comp
because you do not need to recreate it every time.
Comments
Post a Comment