none
How to change the default behavior of the 'x' button of the input element in IE 10.

    Pertanyaan

  • In IE 10, I found that there is an 'x' button on the input=text element, when clicked it, it deletes the text of the input element.

    I want to know how to change the the default behavior of this 'x' button. 

    Because this direct deleting destroes some logic of our product, I hope that I can process the click event of the 'x' button.


    • Diedit oleh DaryLuo 12 Maret 2012 8:02
    08 Maret 2012 8:17

Jawaban

  • Hi, since Internet Explorer 10 is only a Consumer Preview version currently, there may be some compatible issue, I think this issue will go with the release version.
    • Diedit oleh FightAsABull 14 Maret 2012 1:50
    • Ditandai sebagai Jawaban oleh DaryLuo 14 Maret 2012 2:36
    14 Maret 2012 1:50

Semua Balasan

  • 12 Maret 2012 8:05
    Moderator
  • I tried the link, and found that use the ::-ms-clear style, it hides all the 'x' button of the input element on the web page, but I only want to hide some of the input=text element, not all. It is better that I handle the 'x' button click, not hiding it. Is there any way to do it?


    • Diedit oleh DaryLuo 12 Maret 2012 8:54
    12 Maret 2012 8:52
  • input.nobutton{-ms-clear:hide}

    <input type="text" class="nobutton"/>


    Rob^_^

    12 Maret 2012 21:53
  • I'm very sorry, but I tried the -ms-clear: hide  style, and it doesn't work on IE 10, the 'x' button still show on IE10 when input element got focus.

    By the way, it is best that I can handle the 'x' button click event and prevent the default behavior, not hiding it, is there any way to do it?

    My sample code as follows.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <style type="text/css">
            input.nobutton {
                -ms-clear: hide;
                background-color: #b6ff00;
            }
        </style>
    </head>
    <body>
        <input id="text" value="abc" type="text" class="nobutton" />
    </body>
    </html>

    13 Maret 2012 1:34
  • Hi, since Internet Explorer 10 is only a Consumer Preview version currently, there may be some compatible issue, I think this issue will go with the release version.
    • Diedit oleh FightAsABull 14 Maret 2012 1:50
    • Ditandai sebagai Jawaban oleh DaryLuo 14 Maret 2012 2:36
    14 Maret 2012 1:50
  • Thanks, I will wait for the final version of the IE10.
    14 Maret 2012 2:36
  • Sorry Dary, I was almost correct with the css syntax.

    see this answer - http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/7abe117b-9aa4-4185-9d74-1b2f3be65c03

    <!DOCTYPE html>
     <html>
     <head>
         <title>Untitled Page</title>
      
         <style type="text/css">
        
         .nobutton::-ms-clear {
             display: none;
         }
        
         </style>
      
     </head>
     <body>
      
     <input type="text" value="foo" class="nobutton"/>
     </body>
     </html>


    Rob^_^

    14 Maret 2012 8:33
  • Hello...Rob.. ,The above code you have given is absolutely working fine for HTML page...I tried the same for asp & aspx page.Its not working..Do I need to make some changes in the given by you??
    09 Juli 2012 5:59