Tips on eliminating the letter 'X' from a text/search input field in HTML

There are various solutions available for removing the "X" from an input field in IE 10+ browsers. I have tried multiple approaches without success.

For example, I have referenced:

ans 1

ans 2

ans 3

Despite implementing all of these solutions, I still cannot remove the X icon from my input field. Here is a simple input control that I created:

<input type="text" id="RemoveX" />

Below is the CSS I am using to try and hide the X:

input[type=text]::-ms-clear { display: none; width: 0; height: 0; }
input[type=text]::-ms-reveal { display: none; width: 0; height: 0; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }

#RemoveX::-ms-clear { display: none; width: 0; height: 0; }
#RemoveX::-ms-reveal { display: none; width: 0; height: 0; }
#RemoveX::-webkit-search-decoration,
#RemoveX::-webkit-search-cancel-button,
#RemoveX::-webkit-search-results-button,
#RemoveX::-webkit-search-results-decoration { display: none; }

I am specifically working with IE 11 and have verified compatibility mode settings. I am solely focused on addressing this issue in IE 10+ browsers and not testing in other browsers at this time. Any assistance on resolving this matter would be greatly appreciated.

Answer №1

(Haven't tested yet but it is expected to function properly)

$('#yourInput').bind('input', function() { 
   var currentText = $('#yourInput').val();
   var newData = currentText.replace("X", "");
   $('#yourInput').val(newData);
});

UPDATE:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<title>asd</title>
</head>
<script type="text/javascript">
$(document).ready(function(){
$('#myInput').bind('input',function() { 
var currentText = $('#myInput').val();
var newData = currentText.replace("X","");
newData = newData.replace("x",""); // replace small x if needed
$('#myInput').val(newData);
});
});
</script>
<body>
<input type="text" id="myInput" />
</body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Change the data-theme using jQuery Mobile once the page has finished loading

I am facing an issue with my buttons in a control group that represent on/off functionality. Every time I click on one of the buttons to switch their themes, the theme reverts back once I move the mouse away from the button. How can I make sure that the ...

Error in Compiling HTML Elements Collection<<Element>

Currently, I am developing an eCommerce application that features a popup window for users when they click on "Add to Cart." This popup allows users to select product variations and quantities before adding the item to their cart. The popup consists of a s ...

Relocating to reveal or conceal item

I am currently working with jQuery and trying to achieve a specific functionality. My goal is to hide and unhide an element, while also focusing on the exposed area once it becomes visible. I have a link #welcomeselect that, when clicked, should reveal t ...

Why is my jQuery clearQueue function malfunctioning?

I'm facing an issue with my AJAX function where multiple notifications are being displayed if the user calls it repeatedly in a short span of time. I want to show the notification only once and avoid queuing them up. AJAX FUNCTION function update(up ...

ajax-triggered forms

Is there a way to ensure that a form functions correctly when it is included in the HTML loaded via AJAX? I am utilizing jQuery for this task. Any suggestions or advice would be appreciated. ...

Leverage the power of JSON values by incorporating them directly into HTML tags

My JSON file is generating the following styles: { "h1" : { "font-family" : "Lato", "font-size" : "24px", "line-height" : "28px", "font-weight" : 600, "colorId" : 3, "margin-bottom" : "10px", "margin-top" : "20px" }, "h2" : { ...

The logout confirmation message functionality in Laravel 8 is malfunctioning

In my Laravel project, I am attempting to implement a logout confirmation message that will pop up when a user clicks on the logout button. Here is the code I have added to my navbar.blade.php: <a class="dropdown-item" id="logout" hr ...

Navigating through the Jquery DOM to access a specific node

Displayed here are a list of products, presented within an unordered list: Users can express interest in specific items by clicking "I am Interested," prompting a change in background color and the appearance of a tick mark next to the selected item. To ...

Is there a way for me to make this Select update when onChange occurs?

I am facing an issue with a react-select input that is supposed to display country options from a JSON file and submit the selected value. Currently, when a selection is made, the field does not populate with the selection visually, but it still sends the ...

Transferring information from ng-Dialog HTML to a controller

Having some issues with ng-Dialog. When I include the ngDialog controller option, it works. I can retrieve the value of $scope.descriptionText from <p>Description:</p> <textarea ng-model="descriptionText"></textarea> Now, whe ...

Creating a custom Chrome extension with the ability to modify the pop-up window instead of the web page

Is there a way to modify the content inside my extension's pop-up without affecting the web page being viewed by the user? Also, how can I ensure that my dropdown list functions correctly? I have two dropdown lists where selecting an option from the ...

AngularJS HTTP request not functioning properly with duplicate requests in Postman

My postman request is working fine, but the equivalent in angularJS isn't. I'm able to get the response I need in Postman, but for some reason, it's not working in Angular. var settings = { "async": true, "crossDomain": true, ...

Building an expansive navigation menu with react-bootstrap

My current project involves creating a mega menu. Although I successfully made a responsive navbar, the challenge now is to implement a dropdown panel with 100% width. I've tried various approaches but haven't found one that works. Note: The oth ...

How to access a controller function within a recursive directive template in Angular version 1.3?

In my parent directive, I am able to access controller functions using the $parent operator. However, this method does not work in recursive child directives. Here is a shortened example of the issue: // Sample controller code (using controllerAs):--- va ...

Efficiently Minimize Bootstrap Components Upon Clicking the Link

I've successfully created a navigation menu that expands and collapses without using a dropdown feature. However, I'm encountering an issue where I can't seem to toggle the div when clicking on a menu link. I attempted to use JavaScript to c ...

What is the method for ensuring a variable returns a number and not a function?

I've encountered a perplexing issue that I can't seem to solve. What could be causing the code below to output a function instead of a number? let second = function(){ return 100 }; console.log(second); ...

How to serialize an Asp net core resx file and send it back in an ajax request

I have a project in which I am heavily using jQuery. I am curious if it is possible to retrieve the appropriate .resx file (in JSON format) based on the current language through an AJAX call. This way, I can utilize these translations throughout my website ...

Toggling the visibility of divs in a dynamic layout

How can I use JQuery/JavaScript to show only the comment form for a specific post when a button or link is clicked on a page containing multiple posts divs with hidden comment forms? <div class="post"> <p>Some Content</p> <a ...

The html input box's ability to handle overflow situations

Currently, I am working on creating a form that allows users to update data. <dl> <dt>Medical Needs:</dt> <dd class="med_needs" style="height:60px;overflow:auto"> <input type = "text" id="med_needs"name ="med_nee ...

Guide on extracting JSON data from specific nodes using d3.js

Just starting out with d3.js and following the example of a simple molecule created by d3 at http://bl.ocks.org/mbostock/3037015. I have a couple questions: 1. How can I select multiple nodes within the molecule structure? 2. Once selected, how do I ext ...