Armen Armen - 1 year ago 103
CSS Question

In google chrome version 54 disabled fields are unselectable

Seems after last google chrome (version 54) update i'm not able to select via mouse text from disabled fields in my website.

// Text inside this input not selectable by mouse but before it was ...
<input type="text" value="text to copy via mouse" name="name" disabled>

There is no strict response from google support about this issue if it bug or feature:!topic/chrome/YzPWsT_QnDU

douse anyone know if it new feature or bug ? and if there is some way to overwrite this feature by
attribute ?

Answer Source

If someone need a solution for exactly disabled button case i found only way to do it with js copy button implementation through jquery

$( document ).ready(function() {

        $( "input[type='text']:disabled" ).each(function( index, value ) {

            var $element = $(value);
            var width = $element.outerWidth();
            var height = $element.outerHeight();
            var $appendToElement;

            // Wrapper element by relative positioned div
            $appendToElement = $element.parent();

                   'position': 'absolute',
                   'top': 0,
                   'margin-top': $element.css('border-top-width'),
                   'margin-left': $element.css('border-left-width'),
                   'width': width,
                   'height': height,
                   'z-index': 10,
                   'cursor': 'pointer',
                function() {
                    $(this).html("Click to copy");
                function() {
            .click(function() {
                copyToClipboard( $(this).parent().find('input').val() );
           .appendTo( $appendToElement );



function copyToClipboard(text) 
   if (window.clipboardData && window.clipboardData.setData) {

       // IE specific code path to prevent textarea being shown while dialog is visible.
       return clipboardData.setData("Text", text);

   } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {

       var textarea = document.createElement("textarea");

       textarea.textContent = text; = "fixed";  // Prevent scrolling to bottom of page in MS Edge.

       try {
           return document.execCommand("copy");  // Security exception may be thrown by some browsers.
       } catch (ex) {
           return false;
       } finally {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download