JQuery does not depend on function of another control




I have the following code:



```
$(serialNumbersDDL).children("option:gt(0)").remove();

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

It will remove all options except the first. Now I need to remove all parameters except the first, and also not remove the parameter whose value is equal to the label text. How can I tell what is with writing a limited amount of code?
try it



  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  


```
$("option:not(':first')",serialNumbersDDL).filter(function(){
return $(this).val()!=$(this).text();
}).remove();

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```
Okay well if those query parameters really do represent arbitrary text a visitor enters into fields, then personally I would push them to separate Adobe Analytics variables instead of concatenate them, because there's no guarantee on how many characters they will be or what characters will be entered. 

I'm not sure I understand what you mean... is your site just using different query parameters for search terms, depending on the page or search widget used? So e.g. maybe you do a search and it pops k=[search term] but on search results page you do another search and it instead pops query=[new search term] ?  If so, then it sounds to me like you shouldn't concat them, but instead just look for either one and push to the variable.  

Or is it that a visitor can go to your site and search for something that results in both of those parameters showing up in the URL at the same time, with different values? 

I think I need clarification about how your site actually works vs. these two parameters. 




[View solution in original post](/t5/dynamic-tag-management-questions/internal-search-term-tracking/m-p/278167#M1141) hi larry, - - thank you for writing. - - to disable the arrow keys you need to override the onkeydown method:  - - class mypageview : radpageview - { -     protected override void onkeydown(keyeventargs e) -     { -         if (e.keycode == keys.left || e.keycode == keys.right) -         { -             return; -         } -         base.onkeydown(e); -     } - } - - - i hope this information is useful. let me know if you need further assistance. - - regards, - dimitar - telerik by progress - - try our brand new, jquery-free angular 2 components built from ground-up which - deliver the business app essential building blocks - a grid component, - data visualization (charts) and form elements. - You could achieve this with a simple `for` loop:



```
var min = 12,
    max = 100,
    select = document.getElementById('selectElementId');

for (var i = min; i<=max; i++){
    var opt = document.createElement('option');
    opt.value = i;
    opt.innerHTML = i;
    select.appendChild(opt);
}

```

[JS Fiddle demo](https://jsfiddle.net/davidThomas/NX3ac/).


[JS Perf](https://jsperf.com/) comparison of both mine and [Sime Vidas' answer](https://jsperf.com/comparison-of-loops), run because I thought his looked a little more understandable/intuitive than mine and I wondered how that would translate into implementation. According to Chromium 14/Ubuntu 11.04 mine is somewhat faster, other browsers/platforms are likely to have differing results though.







**Edited** in response to comment from OP:



> 
> [How] do [I] apply this to more than one element?
> 
> 
> 



```
function populateSelect(target, min, max){
    if (!target){
        return false;
    }
    else {
        var min = min || 0,
            max = max || min + 100;

        select = document.getElementById(target);

        for (var i = min; i<=max; i++){
            var opt = document.createElement('option');
            opt.value = i;
            opt.innerHTML = i;
            select.appendChild(opt);
        }
    }
}
// calling the function with all three values:
populateSelect('selectElementId',12,100);

// calling the function with only the 'id' ('min' and 'max' are set to defaults):
populateSelect('anotherSelect');

// calling the function with the 'id' and the 'min' (the 'max' is set to default):
populateSelect('moreSelects', 50);

```

[JS Fiddle demo](https://jsfiddle.net/davidThomas/NX3ac/1/).


And, finally (after quite a delay...), an approach extending the prototype of the `HTMLSelectElement` in order to chain the `populate()` function, as a method, to the DOM node:



```
HTMLSelectElement.prototype.populate = function (opts) {
    var settings = {};

    settings.min = 0;
    settings.max = settings.min + 100;

    for (var userOpt in opts) {
        if (opts.hasOwnProperty(userOpt)) {
            settings[userOpt] = opts[userOpt];
        }
    }

    for (var i = settings.min; i <= settings.max; i++) {
        this.appendChild(new Option(i, i));
    }
};

document.getElementById('selectElementId').populate({
    'min': 12,
    'max': 40
});

```

[JS Fiddle demo](https://jsfiddle.net/davidThomas/NX3ac/148/).


References:


* [`node.appendChild()`](https://developer.mozilla.org/en/DOM/node.appendChild).
* [`document.getElementById()`](https://developer.mozilla.org/en/DOM/document.getElementById).
* [`element.innerHTML`](https://developer.mozilla.org/en/DOM/element.innerHTML). can you try with other dropdowns? if its working , nothing wrong with your code and something to do with that specific drop down. hello, 

this code checks to see if the diagonal elements of a given matrix a (assuming n x n) are larger in magnitude than the sum of the magnitude of the non-diagonal elements in its row.

line by line explanation:

the first line loops through all the rows of a.

 for i = 1:n

the second line is defining j = [1 2 3 ... n], so a vector containing 1..n,
 
 j = 1:n;

the third line is removing the diagonal element, aka, the ith row and this removes the ith column, so the i,i th element,
 
 j(i) = [];

the fourth line takes the absolute value of all the elements in the ith row of a, excluding the diagonal element: a(i,j) = a(ith row, elements 1,2,...,i-1,i+1,...,n) since we removed the ith element from j previously.
 
 b = abs(a(i,j));

the fifth line computes the absolute value of the diagonal element minus the sum of the absolute value of all the other elements in the row. if check is positive, we know the magnitude of the diagonal element was greater than the sum of all the magnitudes of the other elements in its row.
 
 check(i) = abs(a(i,i)) - sum(b);

the sixth line checks if it's less than zero, in which case the diagonal elements magnitude is not greater than or equal to the sum of the magnitudes of the other elements.
 
 if check(i) < 0

if this is the case, the matrix is not strictly diagonally dominant, which the seventh line prints.
 
 fprintf('the matrix is not strictly diagonally dominant at row %2i

',i)

the eighth and ninth lines end the cycle.
 
 end
 end

sorry if this was too much detail,

hope this helps! to hide files and folders with the same names on left and right:

jscript:

function onclick(clickdata)

{

var cmdsource = clickdata.func.command;

cmdsource.clearfiles();

var cmddest = dopus.create.command;

cmddest.setsourcetab(clickdata.func.desttab);

cmdsource.runcommand("select deselectnomat… You need to give the user the option of typing in a value that represents that there are no more values to enter. Perhaps give a prompt like:



```
Please enter a value.  Enter -999999 if you have no more values [B]:[/B]
```

As for the ten (or fewer) values, you should probably have an array and a loop instead of ten separate variable names and ten separate cin statements. So you're looking at something like this:



```
double dValue[10];
    int numEntries = 0;
    double sum = 0;
    
    while (numEntries < 10)
    {
          cout << "Enter number (-999999 to stop) : ";
          cin >> dValue[numEntries];
          // check whether dValue[numEntries] == -999999
          // if so, short-circuit the loop with the "break" command
            
          // increment numEntries
          // adjust sum
    }
```

As a side note, I picked -999999 as the value to represent no more values because



1. It's an integer, so it can be represented exactly as a double (no round-off error using == to compare).
2. It's a number that, chances are, people wouldn't actually want to add, so it's sort of "out of the way". Chances are, few people want to add -999999. If they do, they can't use this program! Your test is redundant, since you are already querying only for matching records. In this case, you will get no rows if there is no match, therefore you will never hit the else clause in the loop.  

  

Instead, it is enough to check if there are any matching records at all. The example below shows how (note that you can put a condition straight into Any() instead of specifying Where()).  

  

C#Copy Code

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace CustomerMaster
{
    public partial class CustomerMaster : System.Web.UI.Page
    {
 
        private void AddData()
        {
            
            OperationsDataContext AddDb = new OperationsDataContext();
            CustomerMast cm = new CustomerMast();
            
                        
            cm.CustomerCode = txtCustCde.Text;
            cm.CustomerName = txtCustName.Text;
            cm.CustomerAddress = txtCustAdd.Text;
            cm.BrkrCode = txtBrkCode.Text;
            cm.BrokerName = txtBrkName.Text.
            cm.CrrCode = txtCrrCode.CarrierCode;
            cm.CarrierName =  txtCrrName.Text;
            cm.StnCode=sm.StationCode;
            cm.StationName = txtStnName.Text;
            cm.VatNo=txtVatNo.Text;
            cm.TinNo=txtTinNo.Text;
            cm.TMCO=txtTMCONo.Text;
            cm.PanNo = txtPAN.Text;
			
	    if(AddDb.CustomerMasts.Any(c=>c.CustomerCode == txtCustCde.Text))
            {
	        Response.Write("Error! CustomerCode Exits");
	    }
	    else
	    {
                AddDb.BrokerMasts.InsertOnSubmit(bm);
                AddDb.CarrierMasts.InsertOnSubmit(crm);
                AddDb.StationMasts.InsertOnSubmit(sm);
                AddDb.CustomerMasts.InsertOnSubmit(cm);

	        AddDb.SubmitChanges();
            }         
        }
 
        protected void btnAdd\_Click(object sender, EventArgs e)
        {
            AddData();
        }
    }
}
``` Reason: `s` starts at 1 and is incremented on first call, but is never reset. On seconds and subsequent calls `s` no longer starts at 1. `s` is actually unnecessary as you can use the loop counter `i` instead.



A more conventional way to do this sort of thing would be with a single function, not embedded in an object, and to control the detailed behaviour by passing parameter(s).



```
function loadGame(level){
	var values;
	switch(level){
		case 'hard':
			values: [7,8,9],
		break;
		case 'normal':
			values: [4,5,6],
		break;
		default://easy
			values: [1,2,3],
	}
	for(i=0;i<=this.values.length;i++){
		document.getElementById('n'+i).innerHTML=this.values[i];
	}
}
```


```
<div id="n0"></div>
	<div id="n1"></div>
	<div id="n2"></div>
	<input type="button" value="easy" onClick="loadGame('easy')"/>
	<input type="button" value="normal" onClick="loadGame('normal')"/>
	<input type="button" value="hard" onClick="loadGame('hard')"/>
```

**Airshow** Well, the only piece of the code you wrote that will be of any use for that assignment at all is the Scanner (though a BufferedReader would be my own choice for that). The instructions are pretty clearly laid out and does tell you what you need to use from that jss2 folder.



You need to read the file line by line. The first line is the input to create the BST. For the rest of the lines you will need to parse and match the command token to the appropriate action to take on the BST. String.split() will be useful for that part to separate <command> <parameters>.



So time to crack the books and get a start on it. Post specific questions if you run into trouble. Good luck!