Tuesday 15 July 2014

jquery - Passing a variable to target a specific array -


Hope this is a simple question, but I can not seem to work.

I am trying to pass a variable to reach a specific array and hide the contents of that array.

In this example $ prodCat = labialwire (.each) I am trying to replace labialwire with $ prodCat and hide those items, but it is not working.

jquery:

  $ ('body') ('click', '.deleteLiRadio', function () {var $ prodCat = $ (this). 'Prodcat'), $ ul = "#upperConfirmUl", uncheck = new array (); console.log ($ ProdCat); $ ("li [data-prodcat = '" $ prodCat + "']"). Remove $ ('; Form [data-catalyst =' 'prodCat +'] ') ("reset"); $ ($ ul) .listview ("refresh"); $ ($ ul). Trigger (" Update (")"; $ ('form [data-caturl =' '$ prodCat +' "] Input: no (check). Each (function () {uncheckpush ($ (this) .attr (' Id '));}); //console.log (uncheck); $ .each (uncheck, function (i, val) {labelwire [val] & labwares [val] .hide (); / * $ prodCat with If it helps, then I'm getting an undefined answer using $ prodCat [val].   

If labialwire is a global variable (array):

 < Code> if (window ["LibelWire"]) Window ["LabelWire"]. [Val]. Solution ();   

Or with a string variable with value "labialwire" :

  if (window [$ prodCat]) window [$ prodCat]. [Val] Hide ();    

No comments:

Post a Comment