Posts

Showing posts with the label jquery

How to get how many times there is a matching value?

Given an array: Given that the following gets the current svg path property (I am using leaflet map, so this value is in the json ). I run the following which I found on this answer, basically when I mouse hover a polygon, I get countryName and I check how many times is within that array: But if I do: console.log(result); it always gives me 1 or 0 if no match. In the real scenario an example of console.log(nationList); gives: UDPATE What i did before was to try to count each value: That's fine as it gives me for example: Austria: 22 But when I do: Each time I mouse hover a path with a property name , lets say Austria , even tho within the array we have many repeating occurrences, the console gives me 1 if a match is there or 0 The code that you have posted seems to be working correctly, but as GetOffMyLawn stated you should compare the two as the same case just to be sure. Sorry for the short answer, but not enough reputation at the moment to just post comments. The below...

Sorting a column in table and need the view to remain in same column

I have a table which has first column fixed and rest of the columns are scrollable. Suppose I am in the extreme right end of the table and I click on the header of a column then it sorts and the entire column. But the view is shifting to the start of the table. I want the view to remain in same column By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.