Sunday 15 May 2011

Jquery search on matching elements -


I am implementing a keystroke-based search on visual elements in one device (airports coming down to a country ). In other words, on each key-up event, I hide all those elements that do not have matching phrase (case insensitive) in the text.

Another catch, the search can only be done on the elements, match country id.

is HTML (C # Razor):

  & lt; Div class = "airport" id = "airport-c @ (airport.CountryId) -" name = "airport-one @ (airport. Airport id) -" & gt; & Lt; A ... etc & gt; @ Airport Airport and lieutenant; Period class = "airport country" gt; @ Airport.ountry & lt; / Span & gt; & Lt; / A & gt; & Lt; / Div & gt;   

I have this ID that does not match country ID, but I need to expand it to include search mail, and I'm not sure how it was completed. Go.

  $ ('[id =' airport-c]] [id! = "Airport-c '+ countryId +' - ']'). Wrap ();    

Something like this will happen:

  $ ("A: In ("+ Your_search_term +" ') "," # airport-c "+ Country ID +" - ");   

The above statement can be found on any & lt; a & gt; element that will contain your search term, which is in the ID # airport-c "countryID +" - "



No comments:

Post a Comment