Rectangle 27 12

Yet another more contemporary option (no pun intended) is to disable all the options of the select element other then the selected one.

note however that this is an HTML 4.0 feature and ie 6,7,8 beta 1 seem to not respect this.

javascript - HTML form readonly SELECT tag/input - Stack Overflow

javascript html
Rectangle 27 11

Yet another more contemporary option (no pun intended) is to disable all the options of the select element other then the selected one.

note however that this is an HTML 4.0 feature and ie 6,7,8 beta 1 seem to not respect this.

javascript - HTML form readonly SELECT tag/input - Stack Overflow

javascript html
Rectangle 27 11

Yet another more contemporary option (no pun intended) is to disable all the options of the select element other then the selected one.

note however that this is an HTML 4.0 feature and ie 6,7,8 beta 1 seem to not respect this.

javascript - HTML form readonly SELECT tag/input - Stack Overflow

javascript html
Rectangle 27 11

Yet another more contemporary option (no pun intended) is to disable all the options of the select element other then the selected one.

note however that this is an HTML 4.0 feature and ie 6,7,8 beta 1 seem to not respect this.

javascript - HTML form readonly SELECT tag/input - Stack Overflow

javascript html
Rectangle 27 17

You want something like this - Example Code here

$(function() {

$("input:radio[@name='abc123']").click(function() {
   if($(this).attr('id') == 'abc') {

      // Disable 123 and Enable abc
      $("#theOptions option[value='1']").attr("disabled","disabled");
      $("#theOptions option[value='2']").attr("disabled","disabled");
      $("#theOptions option[value='3']").attr("disabled","disabled");
      $("#theOptions option[value='a']").attr("selected","selected");
      $("#theOptions option[value='a']").attr("disabled","");
      $("#theOptions option[value='b']").attr("disabled","");
      $("#theOptions option[value='c']").attr("disabled","");

   } else {
      // Disable abc's and Enable 123
      $("#theOptions option[value='a']").attr("disabled","disabled");
      $("#theOptions option[value='b']").attr("disabled","disabled");
      $("#theOptions option[value='c']").attr("disabled","disabled");
      $("#theOptions option[value='1']").attr("selected","selected");          
      $("#theOptions option[value='1']").attr("disabled","");   
      $("#theOptions option[value='2']").attr("disabled","");
      $("#theOptions option[value='3']").attr("disabled","");

   }    
});

});

Improved version of the code, using regular expression to filter options based on option values. Working example here. You can edit the example by adding /edit to the URL

$(function() {

    $("input:radio[@name='abc123']").click(function() {

        // get the id of the selected radio
        var radio = $(this).attr('id'); 

        // set variables based on value of radio
        var regexDisabled = radio == 'abc' ?  /[1-3]/ : /[a-c]/;      
        var regexEnabled = radio == 'abc' ? /[a-c]/ : /[1-3]/;
        var selection = radio == 'abc' ? 'a' : 1;

        // select all option elements who are children of id #theOptions
        $("#theOptions option")
            // filter the option elements to only those we want to disable
            .filter( function() { return this.value.match(regexDisabled);})
            // disable them
            .attr("disabled","disabled")
            // return to the previous wrapped set i.e. all option elements
            .end()
            // and filter to those option elements we want to enable
            .filter( function() { return this.value.match(regexEnabled);})
            // enable them
            .attr("disabled","");
       // change the selected option element in the dropdown
       $("#theOptions option[value='" + selection + "']").attr("selected","selected");

    });

});

Since the disabled attribute doesn't appear to work reliably across browsers, I think your only option is to remove the option elements not needed when a radio button is selected. Working Example here

$(function() {

        $("input:radio[@name='abc123']").click(function() {

            // store the option elements in an array
            var options = [];
            options[0] = '<option value="1">1</option>';
            options[1] = '<option value="2">2</option>';
            options[2] = '<option value="3">3</option>';
            options[3] = '<option value="a">a</option>';
            options[4] = '<option value="b">b</option>';
            options[5] = '<option value="c">c</option>';


            var radio = $(this).attr('id');   
            var regexEnabled = radio == 'abc' ? /[a-c]/ : /[1-3]/;

            // set the option elements in #theOptions to those that match the regular expression
            $("#theOptions").html(
            $(options.join(''))
                // filter the option elements to only those we want to include in the dropdown
                .filter( function() { return this.value.match(regexEnabled);})
            );


        });

    });
$(function() {

        // get the child elements of the dropdown when the DOM has loaded
        var options = $("#theOptions").children('option');

        $("input:radio[@name='abc123']").click(function() {         

            var radio = $(this).attr('id');   
            var regexEnabled = radio == 'abc' ? /[a-c]/ : /[1-3]/;

            // set the option elements in #theOptions to those that match the regular expression
            $("#theOptions").html(
            $(options)
                // filter the option elements to only those we want to include in the dropdown
                .filter( function() { return this.value.match(regexEnabled);})
            );

        }); 
    });

I'm trying this but how do I add the removed elements when selecting the other option (Like toggle back and forth). Also how do I check for duplicates? Thanks again for all the help in this issue.

That's handled by the regex matching, either against the option elements in an array (penultimate code example), or against option elements captured in a variable when the DOM has loaded (final code example).

This looks like the best solution but due to the browser issue it just doesn't work for me. Thanks for the efforts

the option element appending will work cross browser but Paolo's got the right idea in wrapping the functionality in a plugin

jQuery disable SELECT options based on Radio selected (Need support fo...

jquery
Rectangle 27 9

The best solution is to use a text input and add the attribute inputmode="url" to provide the URL keyboard facilities. The HTML5 specification was thought for this purpose. If you keep type="url" you get the syntax validation which is not useful in every case (it is better to check if it returns a 404 error instead of the syntax which is quite permissive and is not of a great help).

You also have the possibility to override the default pattern with the attribute pattern="https?://.+" for example to be more permissive.

Putting the novalidate attribute to the form is not the right answer to the asked question because it removes validation for all the fields in the form and you may want to keep validation for email fields for example.

Using jQuery to disable validation is also a bad solution because it should absolutely work without JavaScript.

In my case, I put a select element with 2 options (http:// or https://) before the URL input because I just need websites (and no ftp:// or other things). This way I avoid typing this weird prefix (the biggest regret of Tim Berners-Lee and maybe the main source of URL syntax errors) and I use a simple text input with inputmode="url" with placeholders (without HTTP). I use jQuery and server side script to validate the real existence of the web site (no 404) and to remove the HTTP prefix if inserted (I avoid to use a pattern like pattern="^((?http).)*$" to prevent putting the prefix because I think it is better to be more permissive)

Disable validation of HTML5 form elements - Stack Overflow

validation forms html5 input
Rectangle 27 9

The best solution is to use a text input and add the attribute inputmode="url" to provide the URL keyboard facilities. The HTML5 specification was thought for this purpose. If you keep type="url" you get the syntax validation which is not useful in every case (it is better to check if it returns a 404 error instead of the syntax which is quite permissive and is not of a great help).

You also have the possibility to override the default pattern with the attribute pattern="https?://.+" for example to be more permissive.

Putting the novalidate attribute to the form is not the right answer to the asked question because it removes validation for all the fields in the form and you may want to keep validation for email fields for example.

Using jQuery to disable validation is also a bad solution because it should absolutely work without JavaScript.

In my case, I put a select element with 2 options (http:// or https://) before the URL input because I just need websites (and no ftp:// or other things). This way I avoid typing this weird prefix (the biggest regret of Tim Berners-Lee and maybe the main source of URL syntax errors) and I use a simple text input with inputmode="url" with placeholders (without HTTP). I use jQuery and server side script to validate the real existence of the web site (no 404) and to remove the HTTP prefix if inserted (I avoid to use a pattern like pattern="^((?http).)*$" to prevent putting the prefix because I think it is better to be more permissive)

Disable validation of HTML5 form elements - Stack Overflow

validation forms html5 input
Rectangle 27 9

The best solution is to use a text input and add the attribute inputmode="url" to provide the URL keyboard facilities. The HTML5 specification was thought for this purpose. If you keep type="url" you get the syntax validation which is not useful in every case (it is better to check if it returns a 404 error instead of the syntax which is quite permissive and is not of a great help).

You also have the possibility to override the default pattern with the attribute pattern="https?://.+" for example to be more permissive.

Putting the novalidate attribute to the form is not the right answer to the asked question because it removes validation for all the fields in the form and you may want to keep validation for email fields for example.

Using jQuery to disable validation is also a bad solution because it should absolutely work without JavaScript.

In my case, I put a select element with 2 options (http:// or https://) before the URL input because I just need websites (and no ftp:// or other things). This way I avoid typing this weird prefix (the biggest regret of Tim Berners-Lee and maybe the main source of URL syntax errors) and I use a simple text input with inputmode="url" with placeholders (without HTTP). I use jQuery and server side script to validate the real existence of the web site (no 404) and to remove the HTTP prefix if inserted (I avoid to use a pattern like pattern="^((?http).)*$" to prevent putting the prefix because I think it is better to be more permissive)

Disable validation of HTML5 form elements - Stack Overflow

validation forms html5 input
Rectangle 27 9

The best solution is to use a text input and add the attribute inputmode="url" to provide the URL keyboard facilities. The HTML5 specification was thought for this purpose. If you keep type="url" you get the syntax validation which is not useful in every case (it is better to check if it returns a 404 error instead of the syntax which is quite permissive and is not of a great help).

You also have the possibility to override the default pattern with the attribute pattern="https?://.+" for example to be more permissive.

Putting the novalidate attribute to the form is not the right answer to the asked question because it removes validation for all the fields in the form and you may want to keep validation for email fields for example.

Using jQuery to disable validation is also a bad solution because it should absolutely work without JavaScript.

In my case, I put a select element with 2 options (http:// or https://) before the URL input because I just need websites (and no ftp:// or other things). This way I avoid typing this weird prefix (the biggest regret of Tim Berners-Lee and maybe the main source of URL syntax errors) and I use a simple text input with inputmode="url" with placeholders (without HTTP). I use jQuery and server side script to validate the real existence of the web site (no 404) and to remove the HTTP prefix if inserted (I avoid to use a pattern like pattern="^((?http).)*$" to prevent putting the prefix because I think it is better to be more permissive)

Disable validation of HTML5 form elements - Stack Overflow

validation forms html5 input
Rectangle 27 4

It appears it's not possible to actually use the "value" of a select in any meaningful way as a normal HTML form element and also hook it up to Angular in the approved way with ng-options. As a compromise, I ended up having to put a hidden input alongside my select and have it track the same model as my select, like this (all very much simplified from real production code for brevity):

<select ng-model="profile" ng-options="o.id as o.name for o in profiles" name="something_i_dont_care_about">
</select>
<input name="profile_id" type="text" style="margin-left:-10000px;" ng-model="profile"/>
App.controller('ConnectCtrl',function ConnectCtrl($scope) {
$scope.profiles = [{id:'xyz', name:'a profile'},{id:'abc', name:'another profile'}];
$scope.profile = -1;
}

Then, in my server-side code I just looked for params[:profile_id] (this happened to be a Rails app, but the same principle applies anywhere). Because the hidden input tracks the same model as the select, they stay in sync automagically (no additional javascript necessary). This is the cool part of Angular. It almost makes up for what it does to the value attribute as a side effect.

Interestingly, I found this technique only worked with input tags that were not hidden (which is why I had to use the margin-left:-10000px; trick to move the input off the page). These two variations did not work:

and

I feel like that must mean I'm missing something. It seems too weird for it to be a problem with Angular.

<input name="profile_id" type="hidden" value="{{profile}}"/>

AngularJS - value attribute for select - Stack Overflow

select angularjs options
Rectangle 27 4

It appears it's not possible to actually use the "value" of a select in any meaningful way as a normal HTML form element and also hook it up to Angular in the approved way with ng-options. As a compromise, I ended up having to put a hidden input alongside my select and have it track the same model as my select, like this (all very much simplified from real production code for brevity):

<select ng-model="profile" ng-options="o.id as o.name for o in profiles" name="something_i_dont_care_about">
</select>
<input name="profile_id" type="text" style="margin-left:-10000px;" ng-model="profile"/>
App.controller('ConnectCtrl',function ConnectCtrl($scope) {
$scope.profiles = [{id:'xyz', name:'a profile'},{id:'abc', name:'another profile'}];
$scope.profile = -1;
}

Then, in my server-side code I just looked for params[:profile_id] (this happened to be a Rails app, but the same principle applies anywhere). Because the hidden input tracks the same model as the select, they stay in sync automagically (no additional javascript necessary). This is the cool part of Angular. It almost makes up for what it does to the value attribute as a side effect.

Interestingly, I found this technique only worked with input tags that were not hidden (which is why I had to use the margin-left:-10000px; trick to move the input off the page). These two variations did not work:

and

I feel like that must mean I'm missing something. It seems too weird for it to be a problem with Angular.

<input name="profile_id" type="hidden" value="{{profile}}"/>

AngularJS - value attribute for select - Stack Overflow

select angularjs options
Rectangle 27 5

This is confusing. When you say "form object", do you mean "<select> element"? If not, your code won't work, so I'll assume your form variable is in fact a reference to a <select> element. Why do you want to rewrite this code? What you have has worked in all scriptable browsers since around 1996, and won't stop working any time soon. Doing it with jQuery will immediately make your code slower, more error-prone and less compatible across browsers.

Here's a function that uses your current code as a starting point and populates a <select> element from an object:

<select id="mySelect"></select>

<script type="text/javascript>

function populateSelect(select, optionsData) {
    var options = select.options, o, selected;
    options.length = 0;
    for (var i = 0, len = optionsData.length; i < len; ++i) {
        o = optionsData[i];
        selected = !!o.selected;
        options[i] = new Option(o.text, o.value, selected, selected);
    }
}

var optionsData = [
    {
        text: "Select a city / town in Sweden",
        value: ""
    },
    {
        text: "Melbourne",
        value: "Melbourne",
        selected: true
    }
];

populateSelect(document.getElementById("mySelect"), optionsData);

</script>

javascript - JQuery create new select option - Stack Overflow

javascript jquery html jquery-selectors
Rectangle 27 9

Selectize isn't particularly designed to act just as a select decorator. The cursor comes from an <input> element that allows the user wittle down options. Hiding the input will create strange behavior when the user types. Also, when the control is empty, the input is used to display the placeholder text.

Technically you can hide the cursor (and input) with CSS:

/* option a: make transparent */
.selectize-input input {
    color: transparent !important;
}

/* option b: position off-screen */
.selectize-input input {
    position: absolute !important;
    top: -9999px;
    left: -9999px;
}

But again, this is going to feel funky. I'll look into writing a decorator_only plugin that disables keyboard handling, but it's not an immediate priority.

You can just set maxOptions: 1 and it'll act as a "decorated select"

maxOptions: 1
maxItems: 1

javascript - selectize.js - how can I disable the flashing cursor afte...

javascript jquery selectize.js
Rectangle 27 3

To get the functionality you're after, you need to hook into the change event on the first dropdown, in order to disable the matching element in the second drop-down.

I also initialised the first element in the second dropdown as disabled ( as this chosen by default in the first dropdown)

Used jquery as you are:

<!-- first dropdown -->
<select id="fruit1">
    <option value="1">Apple</option>
    <option value="2">Mango</option>
</select>

<br /> <br />

<!-- second dropdown -->
<select id="fruit2">
    <option value="1" disabled>Apple</option>
    <option value="2">Mango</option>
</select>
$('#fruit1').on( "change", function() {
    var op = $( this ).val();
    $('#fruit2 option').prop('disabled', false);
    $('#fruit2 option[value='+op+']').prop('disabled', true);
});

This should still work, no matter how many options you have in both the dropdowns

Thanks dear... but on first selection it is not working. after that its working perfectly.

You mean, you want it to automatically select a non-clashing item in the second one as well as just disabling the option? It can do that for sure. jsfiddle.net/3pfo1d1f/3

javascript - Disable 2nd dropdown option based on first dropdown - Sta...

javascript jquery html
Rectangle 27 1

the node move down function occurs when a chart element is selected

to disable, clear the selection when the 'select' event fires

tree.setSelection([]);

this will prevent the chart from displaying the next level down...

please see the following working snippet...

google.charts.load('current', {
  callback: drawChart,
  packages:['treemap']
});

function drawChart() {
var data = new google.visualization.DataTable();
  data.addColumn('string', 'ID');
  data.addColumn('string', 'Parent');
  data.addColumn('number', 'Number Of Lines');
  data.addRows([
    ['Shakespeare', null, 0],

    ['Comedies', 'Shakespeare', null],
    ['Tragedies', 'Shakespeare', null],
    ['Histories', 'Shakespeare', null],

    ['As You Like It', 'Comedies', null],
    ['Adam', 'As You Like It', 10],
    ['Amiens', 'As You Like It', 10],
    ['Audrey', 'As You Like It', 12],
    ['Celia', 'As You Like It', 108],
    ['Charles', 'As You Like It', 8],
    ['Corin', 'As You Like It', 24],
    ['Dennis', 'As You Like It', 2],
    ['Duke', 'As You Like It', 32],
    ['Frederick', 'As You Like It', 20],
    ['Hymen', 'As You Like It', 1],
    ['Jaques (lord)', 'As You Like It', 57],
    ['Jaques (son)', 'As You Like It', 2],
    ['Le Beau', 'As You Like It', 14],
    ['Oliver', 'As You Like It', 37],
    ['Orlando', 'As You Like It', 120],
    ['Phebe', 'As You Like It', 23],
    ['Rosalind', 'As You Like It', 201],
    ['Silvius', 'As You Like It', 24],
    ['Sir Oliver Martext', 'As You Like It', 3],
    ['Touchstone', 'As You Like It', 74],
    ['William', 'As You Like It', 11],

    ['Comedy Of Errors', 'Comedies', null],
    ['Adriana', 'Comedy Of Errors', 79],
    ['Aegeon', 'Comedy Of Errors', 17],
    ['Aemilia', 'Comedy Of Errors', 16],
    ['Angelo', 'Comedy Of Errors', 31],
    ['Antipholus of Ephesus', 'Comedy Of Errors', 76],
    ['Antipholus of Syracuse', 'Comedy Of Errors', 103],
    ['Balthazar', 'Comedy Of Errors', 5],
    ['Courtezan', 'Comedy Of Errors', 11],
    ['Dromio of Ephesus', 'Comedy Of Errors', 63],
    ['Dromio of Syracuse', 'Comedy Of Errors', 99],
    ['Luce', 'Comedy Of Errors', 7],
    ['Luciana', 'Comedy Of Errors', 43],
    ['Pinch', 'Comedy Of Errors', 6],
    ['Solinus', 'Comedy Of Errors', 22],

    ['Merchant Of Venice', 'Comedies', null],
    ['Antonio', 'Merchant Of Venice', 47],
    ['Balthasar', 'Merchant Of Venice', 1],
    ['Bassanio', 'Merchant Of Venice', 73],
    ['Duke (of Venice)', 'Merchant Of Venice', 18],
    ['Gratiano', 'Merchant Of Venice', 48],
    ['Jessica', 'Merchant Of Venice', 26],
    ['Launcelot Gobbo', 'Merchant Of Venice', 44],
    ['Leonardo', 'Merchant Of Venice', 2],
    ['Lorenzo', 'Merchant Of Venice', 47],
    ['Nerissa', 'Merchant Of Venice', 36],
    ['Old Gobbo', 'Merchant Of Venice', 19],
    ['Portia', 'Merchant Of Venice', 117],
    ['Prince of Arragon', 'Merchant Of Venice', 4],
    ['Prince of Morocco', 'Merchant Of Venice', 7],
    ['Salanio', 'Merchant Of Venice', 18],
    ['Salarino', 'Merchant Of Venice', 27],
    ['Salerio', 'Merchant Of Venice', 6],
    ['Shylock', 'Merchant Of Venice', 79],
    ['Stephano', 'Merchant Of Venice', 3],
    ['Tubal', 'Merchant Of Venice', 8],

    ['Midsummer Night\'s Dream', 'Comedies', null],
    ['Bottom', 'Midsummer Night\'s Dream', 59],
    ['Cobweb', 'Midsummer Night\'s Dream', 4],
    ['Demetrius', 'Midsummer Night\'s Dream', 48],
    ['Egeus', 'Midsummer Night\'s Dream', 7],
    ['Fairy', 'Midsummer Night\'s Dream', 4],
    ['Flute', 'Midsummer Night\'s Dream', 18],
    ['Helena', 'Midsummer Night\'s Dream', 36],
    ['Hermia', 'Midsummer Night\'s Dream', 48],
    ['Hippolyta', 'Midsummer Night\'s Dream', 14],
    ['Lysander', 'Midsummer Night\'s Dream', 50],
    ['Moth', 'Midsummer Night\'s Dream', 2],
    ['Mustardseed', 'Midsummer Night\'s Dream', 5],
    ['Oberon', 'Midsummer Night\'s Dream', 29],
    ['Peaseblossom', 'Midsummer Night\'s Dream', 4],
    ['Philostrate', 'Midsummer Night\'s Dream', 6],
    ['Puck', 'Midsummer Night\'s Dream', 33],
    ['Quince', 'Midsummer Night\'s Dream', 40],
    ['Snout', 'Midsummer Night\'s Dream', 9],
    ['Snug', 'Midsummer Night\'s Dream', 4],
    ['Starveling', 'Midsummer Night\'s Dream', 7],
    ['Theseus', 'Midsummer Night\'s Dream', 48],
    ['Titania', 'Midsummer Night\'s Dream', 23],

    ['Taming Of The Shrew', 'Comedies', null],
    ['Baptista Minola', 'Taming Of The Shrew', 68],
    ['Bianca', 'Taming Of The Shrew', 29],
    ['Biondello', 'Taming Of The Shrew', 39],
    ['Christopher Sly', 'Taming Of The Shrew', 24],
    ['Curtis', 'Taming Of The Shrew', 20],
    ['Gremio', 'Taming Of The Shrew', 58],
    ['Grumio', 'Taming Of The Shrew', 63],
    ['Haberdasher', 'Taming Of The Shrew', 1],
    ['Hortensio', 'Taming Of The Shrew', 70],
    ['Joseph',  'Taming Of The Shrew', 1],
    ['Katherina', 'Taming Of The Shrew', 82],
    ['Lucentio',  'Taming Of The Shrew', 61],
    ['Nathaniel', 'Taming Of The Shrew', 4],
    ['Nicholas', 'Taming Of The Shrew', 1],
    ['Peter',  'Taming Of The Shrew', 2],
    ['Petruchio', 'Taming Of The Shrew', 158],
    ['Philip',  'Taming Of The Shrew', 1],
    ['Tranio', 'Taming Of The Shrew', 90],
    ['Vincentio', 'Taming Of The Shrew', 23],

    ['The Tempest', 'Comedies', null],
    ['Adrian', 'The Tempest', 9],
    ['Alonso', 'The Tempest', 40],
    ['Antonio, duke of Milan', 'The Tempest', 57],
    ['Ariel', 'The Tempest', 45],
    ['Caliban', 'The Tempest', 50],
    ['Ceres', 'The Tempest', 4],
    ['Ferdinand', 'The Tempest', 31],
    ['Francisco', 'The Tempest', 2],
    ['Gonzalo', 'The Tempest', 52],
    ['Iris', 'The Tempest', 4],
    ['Juno', 'The Tempest', 2],
    ['Master', 'The Tempest', 2],
    ['Miranda', 'The Tempest', 50],
    ['Nymphs', 'The Tempest', 0],
    ['Prospero', 'The Tempest', 114],
    ['Reapers', 'The Tempest', 0],
    ['Sebastian', 'The Tempest', 67],
    ['Stephano (Servant to Portia)', 'The Tempest', 60],
    ['Trinculo', 'The Tempest', 39],

    ['Henry VIII', 'Histories', null],
    ['Anne Bullen', 'Henry VIII', 18],
    ['Archbishop Cranmer', 'Henry VIII', 21],
    ['Bishop Lincoln', 'Henry VIII', 2],
    ['Brandon', 'Henry VIII', 6],
    ['Capucius', 'Henry VIII', 5],
    ['Cardinal Campeius', 'Henry VIII', 14],
    ['Cardinal Wolsey', 'Henry VIII', 79],
    ['Cromwell', 'Henry VIII', 21],
    ['Doctor Butts', 'Henry VIII', 4],
    ['Duke of Buckingham', 'Henry VIII', 26],
    ['Duke of Norfolk', 'Henry VIII', 48],
    ['Duke of Suffolk', 'Henry VIII', 30],
    ['Earl of Surrey', 'Henry VIII', 24],
    ['First Secretary to Wolsey', 'Henry VIII', 2],
    ['Gardiner', 'Henry VIII', 22],
    ['Garter', 'Henry VIII', 1],
    ['Griffith', 'Henry VIII', 13],
    ['King Henry VIII', 'Henry VIII', 81],
    ['Lord Abergavenny', 'Henry VIII', 5],
    ['Lord Chamberlain', 'Henry VIII', 38],
    ['Lord Chancellor', 'Henry VIII', 7],
    ['Lord Sands', 'Henry VIII', 17],
    ['Old Lady', 'Henry VIII', 14],
    ['Patience', 'Henry VIII', 3],
    ['Porter (door-keeper of the Council-chamber)', 'Henry VIII', 10],
    ['Queen Katharine', 'Henry VIII', 50],
    ['Sir Anthony Denny', 'Henry VIII', 3],
    ['Sir Henry Guildford', 'Henry VIII', 1],
    ['Sir Nicholas Vaux', 'Henry VIII', 1],
    ['Sir Thomas Lovell', 'Henry VIII', 21],
    ['Surveyor to the Duke of Buckingham', 'Henry VIII', 9],

    ['History Of King John', 'Histories', null],
    ['Arthur Duke of Bretagne', 'History Of King John', 23],
    ['Blanch', 'History Of King John', 9],
    ['Cardinal Pandulph', 'History Of King John', 23],
    ['Chatillon', 'History Of King John', 5],
    ['Constance', 'History Of King John', 36],
    ['Essex', 'History Of King John', 1],
    ['Faulconbridge', 'History Of King John', 4],
    ['Hubert de Burgh', 'History Of King John', 52],
    ['James Gurney', 'History Of King John', 1],
    ['King John', 'History Of King John', 95],
    ['King Phillip', 'History Of King John', 43],
    ['Lady Faulconbridge', 'History Of King John', 5],
    ['Lewis the Dauphin', 'History Of King John', 29],
    ['Lord Bigot', 'History Of King John', 6],
    ['Lymoges duke of Austria', 'History Of King John', 16],
    ['Melun', 'History Of King John', 3],
    ['Pembroke earl of Pembroke', 'History Of King John', 20],
    ['Peter of Pomfret', 'History Of King John', 1],
    ['Philip the Bastard', 'History Of King John', 89],
    ['Prince Henry', 'History Of King John', 8],
    ['Queen Elinor', 'History Of King John', 22],
    ['Salisbury earl of Salisbury', 'History Of King John', 36],

    ['Antony And Cleopatra', 'Tragedies', null],
    ['Agrippa', 'Antony And Cleopatra', 28],
    ['Alexas', 'Antony And Cleopatra', 15],
    ['Antony', 'Antony And Cleopatra', 202],
    ['Canidius', 'Antony And Cleopatra', 10],
    ['Captain', 'Antony And Cleopatra', 1],
    ['Charmian', 'Antony And Cleopatra', 63],
    ['Cleopatra', 'Antony And Cleopatra', 204],
    ['Demetrius (Friend to Antony)', 'Antony And Cleopatra', 2],
    ['Dercetas', 'Antony And Cleopatra', 5],
    ['Diomedes', 'Antony And Cleopatra', 7],
    ['Dolabella', 'Antony And Cleopatra', 23],
    ['Domitius Enobarus', 'Antony And Cleopatra', 113],
    ['Egyptian', 'Antony And Cleopatra', 2],
    ['Eros', 'Antony And Cleopatra', 27],
    ['Euphronius', 'Antony And Cleopatra', 5],
    ['Gallus', 'Antony And Cleopatra', 1],
    ['Iras', 'Antony And Cleopatra', 18],
    ['Lepidus', 'Antony And Cleopatra', 30],
    ['Mardian', 'Antony And Cleopatra', 7],
    ['Mecaenas', 'Antony And Cleopatra', 16],
    ['Menas', 'Antony And Cleopatra', 35],
    ['Menecrates', 'Antony And Cleopatra', 2],
    ['Octavia', 'Antony And Cleopatra', 13],
    ['Octavius', 'Antony And Cleopatra', 98],
    ['Philo', 'Antony And Cleopatra', 2],
    ['Pompey', 'Antony And Cleopatra', 41],
    ['Proculeius', 'Antony And Cleopatra', 10],
    ['Scarus', 'Antony And Cleopatra', 12],
    ['Seleucus', 'Antony And Cleopatra', 3],
    ['Silius', 'Antony And Cleopatra', 3],
    ['Taurus', 'Antony And Cleopatra', 1],
    ['Thyreus', 'Antony And Cleopatra', 12],
    ['Varrius', 'Antony And Cleopatra', 1],
    ['Ventidius', 'Antony And Cleopatra', 4],

    ['Coriolanus', 'Tragedies', null],
    ['Aedile', 'Coriolanus', 10],
    ['Cominius', 'Coriolanus', 67],
    ['Coriolanus (Caius Marcius Coriolanus)', 'Coriolanus', 189],
    ['Junius Brutus', 'Coriolanus', 91],
    ['Lieutenant',  'Coriolanus', 4],
    ['Menenius Agrippa',  'Coriolanus', 162],
    ['Patrician', 'Coriolanus', 3],
    ['Roman', 'Coriolanus', 10],
    ['Sicinius Velutus', 'Coriolanus', 117],
    ['Titus Lartius', 'Coriolanus', 23],
    ['Tullus Aufidius', 'Coriolanus', 45],
    ['Valeria', 'Coriolanus', 14],
    ['Virgilia', 'Coriolanus', 26],
    ['Volsce', 'Coriolanus', 9],
    ['Volumnia',  'Coriolanus', 57],
    ['Young Coriolanus', 'Coriolanus', 1],

    ['Cymbeline', 'Tragedies', null],
    ['Arviragus', 'Cymbeline', 46],
    ['Belarius', 'Cymbeline', 58],
    ['Caius Lucius', 'Cymbeline', 25],
    ['Cloten',  'Cymbeline', 77],
    ['Cornelius (physician)', 'Cymbeline', 13],
    ['Cymbeline, King of Britain', 'Cymbeline', 81],
    ['Guiderius', 'Cymbeline', 62],
    ['Helen',  'Cymbeline', 0],
    ['Iachimo', 'Cymbeline', 77],
    ['Imogen',  'Cymbeline', 118],
    ['Jupiter', 'Cymbeline', 1],
    ['Philario', 'Cymbeline', 14],
    ['Pisanio',  'Cymbeline', 58],
    ['Posthumus Leonatus', 'Cymbeline', 77],
    ['Queen',  'Cymbeline', 27],
    ['Roman Captain', 'Cymbeline', 4],
    ['Sicilius Leonatus', 'Cymbeline', 7],

    ['The Tragedy of Hamlet, Prince of Denmark', 'Tragedies', null],
    ['Bernardo', 'The Tragedy of Hamlet, Prince of Denmark', 19],
    ['Claudius, King of Denmark', 'The Tragedy of Hamlet, Prince of Denmark', 102],
    ['Cornelius', 'The Tragedy of Hamlet, Prince of Denmark', 1],
    ['Father\'s Ghost', 'The Tragedy of Hamlet, Prince of Denmark', 15],
    ['Fortinbras', 'The Tragedy of Hamlet, Prince of Denmark', 6],
    ['Francisco ', 'The Tragedy of Hamlet, Prince of Denmark', 8],
    ['Gertrude', 'The Tragedy of Hamlet, Prince of Denmark', 69],
    ['Guildenstern', 'The Tragedy of Hamlet, Prince of Denmark', 29],
    ['Hamlet', 'The Tragedy of Hamlet, Prince of Denmark', 358],
    ['Horatio', 'The Tragedy of Hamlet, Prince of Denmark', 109],
    ['Laertes', 'The Tragedy of Hamlet, Prince of Denmark', 62],
    ['Lucianus', 'The Tragedy of Hamlet, Prince of Denmark', 0],
    ['Marcellus', 'The Tragedy of Hamlet, Prince of Denmark', 37],
    ['Ophelia', 'The Tragedy of Hamlet, Prince of Denmark', 58],
    ['Osric', 'The Tragedy of Hamlet, Prince of Denmark', 25],
    ['Polonius', 'The Tragedy of Hamlet, Prince of Denmark', 86],
    ['Reynaldo', 'The Tragedy of Hamlet, Prince of Denmark', 13],
    ['Rosencrantz', 'The Tragedy of Hamlet, Prince of Denmark', 48],
    ['Voltemand', 'The Tragedy of Hamlet, Prince of Denmark', 1],

    ['Julius Caesar', 'Tragedies', null],
    ['Antony (Marcus Antonius)', 'Julius Caesar', 51],
    ['Artemidorus of Cnidos', 'Julius Caesar', 4],
    ['Brutus (Marcus Brutus)', 'Julius Caesar', 194],
    ['Caesar (Julius Caesar)', 'Julius Caesar', 42],
    ['Calpurnia', 'Julius Caesar', 6],
    ['Casca', 'Julius Caesar', 39],
    ['Cassius', 'Julius Caesar', 140],
    ['Cicero', 'Julius Caesar', 4],
    ['Cinna', 'Julius Caesar', 11],
    ['Cinna the Poet', 'Julius Caesar', 8],
    ['Claudius', 'Julius Caesar', 2],
    ['Clitus', 'Julius Caesar', 8],
    ['Dardanius', 'Julius Caesar', 3],
    ['Decius Brutus', 'Julius Caesar', 12],
    ['Flavius', 'Julius Caesar', 5],
    ['Lepidus (Marcus Antonius Lepidus)', 'Julius Caesar', 3],
    ['Ligarius', 'Julius Caesar', 5],
    ['Lucilius', 'Julius Caesar', 10],
    ['Lucius', 'Julius Caesar', 24],
    ['Marullus', 'Julius Caesar', 6],
    ['Messala', 'Julius Caesar', 20],
    ['Metellus Cimber', 'Julius Caesar', 5],
    ['Octavius (Octavius Caesar)', 'Julius Caesar', 19],
    ['Pindarus', 'Julius Caesar', 5],
    ['Popilius (Popilius Lena)', 'Julius Caesar', 2],
    ['Portia (wife of Brutus)', 'Julius Caesar', 16],
    ['Publius', 'Julius Caesar', 2],
    ['Strato', 'Julius Caesar', 4],
    ['Tintinius', 'Julius Caesar', 10],
    ['Trebonius', 'Julius Caesar', 4],
    ['Varro', 'Julius Caesar', 6],
    ['Volumnius', 'Julius Caesar', 3],
    ['Young Cato', 'Julius Caesar', 3],

    ['King Lear', 'Tragedies', null],
    ['Cordelia',  'King Lear', 31],
    ['Curan',  'King Lear', 4],
    ['Duke of Albany', 'King Lear', 58],
    ['Duke of Burgundy', 'King Lear', 5],
    ['Duke of Cornwall', 'King Lear', 53],
    ['Earl of Gloucester', 'King Lear', 118],
    ['Earl of Kent', 'King Lear', 127],
    ['Edgar',  'King Lear', 98],
    ['Edmund', 'King Lear', 79],
    ['Goneril', 'King Lear', 53],
    ['King of France', 'King Lear', 5],
    ['Lear', 'King Lear', 188],
    ['Oswald', 'King Lear', 38],
    ['Regan',  'King Lear', 73],

    ['The Tragedy Of Macbeth', 'Tragedies', null],
    ['Angus', 'The Tragedy Of Macbeth', 4],
    ['Banquo', 'The Tragedy Of Macbeth', 33],
    ['Caithness', 'The Tragedy Of Macbeth', 3],
    ['Donalbain', 'The Tragedy Of Macbeth', 3],
    ['Duncan', 'The Tragedy Of Macbeth', 18],
    ['Fleance', 'The Tragedy Of Macbeth', 2],
    ['Hecate', 'The Tragedy Of Macbeth', 2],
    ['Lady Macbeth', 'The Tragedy Of Macbeth', 59],
    ['Lady Macduff', 'The Tragedy Of Macbeth', 19],
    ['Lennox', 'The Tragedy Of Macbeth', 21],
    ['Macbeth', 'The Tragedy Of Macbeth', 146],
    ['Macduff', 'The Tragedy Of Macbeth', 59],
    ['Malcolm', 'The Tragedy Of Macbeth', 40],
    ['Menteith', 'The Tragedy Of Macbeth', 5],
    ['Porter', 'The Tragedy Of Macbeth', 4],
    ['Ross', 'The Tragedy Of Macbeth', 39],
    ['Seyton', 'The Tragedy Of Macbeth', 5],
    ['Siward', 'The Tragedy Of Macbeth', 11],
    ['Son (Macduff\'s son)', 'The Tragedy Of Macbeth', 14],
    ['Young Siward', 'The Tragedy Of Macbeth', 4],

    ['The Tragedy Of Othello', 'Tragedies', null],
    ['Bianca (Mistress to Cassio)', 'The Tragedy Of Othello', 15],
    ['Brabantio', 'The Tragedy Of Othello', 30],
    ['Cassio', 'The Tragedy Of Othello', 110],
    ['Desdemona', 'The Tragedy Of Othello', 165],
    ['Duke of Venice', 'The Tragedy Of Othello', 25],
    ['Emilia', 'The Tragedy Of Othello', 103],
    ['Gratiano (Brother to Brabantio)', 'The Tragedy Of Othello', 20],
    ['Iago', 'The Tragedy Of Othello', 272],
    ['Lodovico', 'The Tragedy Of Othello', 33],
    ['Montano', 'The Tragedy Of Othello', 24],
    ['Othello', 'The Tragedy Of Othello', 274],
    ['Roderigo', 'The Tragedy Of Othello', 59],

    ['Romeo And Juliet', 'Tragedies', null],
    ['Abraham', 'Romeo And Juliet', 5],
    ['Balthasar (Servant to Romeo)', 'Romeo And Juliet', 12],
    ['Benvolio', 'Romeo And Juliet', 64],
    ['Capulet', 'Romeo And Juliet', 51],
    ['Friar John', 'Romeo And Juliet', 4],
    ['Friar Laurence', 'Romeo And Juliet', 55],
    ['Gregory', 'Romeo And Juliet', 15],
    ['Juliet', 'Romeo And Juliet', 118],
    ['Lady Capulet', 'Romeo And Juliet', 45],
    ['Lady Montague', 'Romeo And Juliet', 2],
    ['Mercutio', 'Romeo And Juliet', 62],
    ['Montague', 'Romeo And Juliet', 10],
    ['Paris', 'Romeo And Juliet', 23],
    ['Peter (Servant to Juliet\'s Nurse)', 'Romeo And Juliet', 13],
    ['Prince Escalus', 'Romeo And Juliet', 16],
    ['Romeo', 'Romeo And Juliet', 163],
    ['Sampson', 'Romeo And Juliet', 20],
    ['Tybalt', 'Romeo And Juliet', 17]
  ]);

  var tree = new google.visualization.TreeMap(document.getElementById('chart_div'));

  var options = {
    highlightOnMouseOver: true,
    maxDepth: 1,
    maxPostDepth: 2,
    minHighlightColor: '#8c6bb1',
    midHighlightColor: '#9ebcda',
    maxHighlightColor: '#edf8fb',
    minColor: '#009688',
    midColor: '#f7f7f7',
    maxColor: '#ee8100',
    headerHeight: 15,
    showScale: true,
    height: 500,
    useWeightedAverageForAggregation: true
  };

  google.visualization.events.addListener(tree, 'select', function () {
    tree.setSelection([]);
  });

  tree.draw(data, options);
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>

javascript - Disable a move down in Google Charts Treemap - Stack Over...

javascript charts google-visualization treemap
Rectangle 27 1

Disabled elements are not submitted with the form.

You have a few options:

readonly
disabled="disabled"
  • Leave the <select> disabled but put the real value in a <input type="hidden">
  • Enable the element before submitting

But whatever you do, make sure you're receiving the correct amount of money because it's very easy for a user to hack around this.

javascript - Disabled=Disabled Option Not Working With Paypal Form - S...

javascript paypal
Rectangle 27 2

This happens because Firefox doesn't send a change event on key-driven changes of the select. Angular doesn't see the change until the tab is hit, so the submit button isn't enabled until after the tab has been processed by the browser (and focus sent to some other element, e.g., the address bar). The W3C standard suggests not sending the event until the control loses focus, although Chrome sends one for any change and Firefox does if the change was mouse-driven.

As suggested in the issue tracker, solve it by manually issuing the change event via the following select directive (http://jsfiddle.net/j5ZzE/):

myApp.directive("select", function () {
    return {
        restrict: "E",
        require: "?ngModel",
        scope: false,
        link: function (scope, element, attrs, ngModel) {
            if (!ngModel) {
                return;
            }
            element.bind("keyup", function () {
                element.trigger("change");
            })
        }
    }
})

You'll need JQuery loaded before AngularJS to have the trigger function available on the element object.

Manually include an empty option (<option value=""></option>) in your select or the first option will be auto-selected when the control receives focus.

Unlike the default behavior, this empty option will not disappear after selecting a real option. I suppose you could remove the empty option by declaring all the options via ng-options or ng-repeat and then removing the empty one from the bound scope once a real option has been selected, but I've never tried it.

Unfortunately. jQuery provides the .trigger() element method used in the directive. The jqLite library included with Angular doesn't provide it. I'm not a javascript guru, but maybe you can send the change event with pure js: stackoverflow.com/q/5658849/448970 or stackoverflow.com/q/2490825/448970

forms - AngularJS and Tab Order (Disabled Buttons) - Stack Overflow

forms angularjs user-experience
Rectangle 27 2

This happens because Firefox doesn't send a change event on key-driven changes of the select. Angular doesn't see the change until the tab is hit, so the submit button isn't enabled until after the tab has been processed by the browser (and focus sent to some other element, e.g., the address bar). The W3C standard suggests not sending the event until the control loses focus, although Chrome sends one for any change and Firefox does if the change was mouse-driven.

As suggested in the issue tracker, solve it by manually issuing the change event via the following select directive (http://jsfiddle.net/j5ZzE/):

myApp.directive("select", function () {
    return {
        restrict: "E",
        require: "?ngModel",
        scope: false,
        link: function (scope, element, attrs, ngModel) {
            if (!ngModel) {
                return;
            }
            element.bind("keyup", function () {
                element.trigger("change");
            })
        }
    }
})

You'll need JQuery loaded before AngularJS to have the trigger function available on the element object.

Manually include an empty option (<option value=""></option>) in your select or the first option will be auto-selected when the control receives focus.

Unlike the default behavior, this empty option will not disappear after selecting a real option. I suppose you could remove the empty option by declaring all the options via ng-options or ng-repeat and then removing the empty one from the bound scope once a real option has been selected, but I've never tried it.

Unfortunately. jQuery provides the .trigger() element method used in the directive. The jqLite library included with Angular doesn't provide it. I'm not a javascript guru, but maybe you can send the change event with pure js: stackoverflow.com/q/5658849/448970 or stackoverflow.com/q/2490825/448970

forms - AngularJS and Tab Order (Disabled Buttons) - Stack Overflow

forms angularjs user-experience
Rectangle 27 1

It's not angularstrap feature, but you can use attributes like ng-hide, ng-show or ng-if to hide specific <div> element when your select has only one item.

Single select
<label>Single select:&nbsp;</label>
<button ng-if="icons.length > 1" type="button" class="btn btn-default" ng-model="selectedIcon" data-html="1" bs-options="icon.value as icon.label for icon in icons" bs-select>
  Action <span class="caret"></span>
</button>
<button ng-if="icons.length === 1" type="button" class="btn btn-default" ng-model="selectedIcon" data-html="1">
  {{icons[0].value}}
</button>

I can't add gear icon, but I hope it's easy fix ;)

Pls check the example in updated question. The dropdown <div> is created by angularstrap, not by app itself.

Your solution works in select only having one item. However the model selectedIcon won't be updated when changing the option if there are more than one option. See the symptom in updated example.

@Kane It works when you use ng-show instead of ng-if. I guess it may be problem with $scope.

Sorry for accepting it late. The demo code works fine now. Something strange still is happening in my project. The model object still can NOT be updated after the option is changed. Obviously the controller of my project is more complicated than the demo. Anyway you deserved it.

javascript - How to disable the dropdown menu of select when the selec...

javascript angularjs angular-strap
Rectangle 27 2

I had a similar issue with IE11 that turned out to be any modification to the .text property of an SELECT-option element. I eventually found the "hint" on stackoverflow here How to fix IE select issue when dynamically changing options.

In my case I use straight JavaScript, and with so many inter-dependent SELECT boxes had to come up with a generic solution, so my solution was to intercept (defineGetter) assignment to any .text property of an HTMLOptionElement, and set a 1 ms timer to perform an add element and remove element as in the referenced post that is titled "I have the fix. We have to add and remove options list to trigger the rendering in IE8." Notice the reference to IE8, AFAIK IE has had several issues with SELECT boxes since at least IE7, possibly earlier.

So the code I added to one of my global scripts is as follows:

try { var IE11;  // IE10 and IE11 removed ActiveXObject from the window object but it can still be instantiated
    IE11 = new ActiveXObject('MSXML2.DOMDocument.6.0');
    IE11 = null;
    if (typeof(HTMLOptionElement) != "undefined") {
        try { HTMLOptionElement.prototype.__defineSetter__(
                                          'text',
                                          function(original) {
                                              return function(newValue) { var sel;
                                                                       original.call(this, newValue);
                                                                       if (!(sel=this.parentElement).fixIE) sel.fixIE = window.setTimeout(_fixIE_(sel), 1);
                                                                   }
                                                               }(HTMLOptionElement.prototype.__lookupSetter__('text')));
            } catch(e) {};
        }
    } catch(e) {}
}

//  IE11 broke SELECT boxes again, modifying any options .text attribute "freezes" the SELECT so it appears disabled
function _fixIE_(selBox) {
    return _fixIE_;
    function _fixIE_(){ var lc = selBox.options.length;
        selBox.options.add(new Option('',''));
        selBox.options.remove(lc);
        selBox.fixIE = undefined;
    }
}

Dude, this is an awesome, awesome find. I got all sorts of crazy errors and this seems to be the culprit. Accept now IE tells me I can't use indexed db?! on a change event :D. Damnit Microsoft...

html - Strange IE11 form fields bug after selecting from dropdown - St...

html forms internet-explorer internet-explorer-11