javascript - Hide select options depending on value of another select -


There are a few similar questions, but none of them fit me.

The method of filtering options on the selection based on the value selected in one of the other selections I select Firstly, select one of the options with ordinary numerical value 1,2,3 ... second , Which should be filtered, includes options for 'groups' in the hundreds of options, ie, 102, 103, 202, 254 ...

If Option 1 option starts with only 1 Options to be priced are being chosen You should see it in the second selection. And every time the user selects one option.

I have tried this piece of code, but it does not work.

  Function Filters Institution (AMM) {Var currRow = elem.closest ("tr") var inType = elem.val (); CurrRow.find ("COMPName Options"). Toggle (wrong); (".comName Options"). Each (function () {$ ("[value ^ =" + inType + "]", $ (this)) toggle (true);}); }  

Here there are only a few options, but in reality, 80+ options are available in the second selection.

My idea was to hide all the options and only to show the options that started with the selected number from the first option.

"post-text" itemprop = "text">

When you say that

  $ ("[value =" + int + "]", $ (This))  

You are asking jQuery to find the elements that meet the criteria "[value =" + InType + "]" And they are also descendants of $ (this) . Check what you want to do instead, get the $ (this) criteria.

Here is a separate version:

  var currRow = Elem.closest ("tr") var inType = elem.val (); "Filter" ("[value ^ =" + inType + "]") // This will make the filter you want. Show (); // equivalent Toggle (True)  

Field here:


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -