• Register
0 votes
202 views

Problem :

Facing following chrome error
error in event handler for (unknown): typeerror: cannot read property 'indexof' of undefined
6.9k points

1 Answer

0 votes

Solution :

1. No need to use a jQuery each for this. 

2. No need to alter an array that you are operating on. If you want to remove elements from an array then you can use filter. Filter has following signature:

someArray.filter(function(item, index, array) {
  // filter to return a value that is truthy to keep an item or falsey to remove it
})

3. Filter always returns a new array with only the values that match what you want.In your case it should look as follows:

e.g
var filteredProducts = cart_products.filter(function(item) {
  return item.indexOf(product + "^")
})
38.6k points

Related questions

0 votes
1 answer 6 views
6 views
We are developing an SharePoing web application and got this error. Can any one here solve this solve this problem?
asked Sep 28 Daniel Anderson 4k points
1 vote
1 answer 259 views
259 views
Problem: I have elementary knowledge of Jquery and Javascript. Currently I am working on the pagination and I am trying to use the DataTables plugin. I have observed that on some of the tables it works as expected but on some of my tables it gives below error: " ... it is very common error but I am unable to find anything related to my problem. Kindly help me if any Jquery expert is around.
asked Jun 2 Martin K 6.6k points