What is preventing my textbox from accepting decimal points?

After applying this code, I encountered an issue where the textbox does not accept input with a decimal point ..

<asp:TextBox ID="txtDetAmount" runat="server" AutoPostBack="true" 
     OnTextChanged="OntxtDetAmountChanged"  
     style="width: 50%;" AutoComplete="off" 
     onkeydown = "return (!(event.keyCode>=65) && event.keyCode!=32);">
</asp:TextBox>

Answer №1

There appears to be an issue with this code snippet: !(event.keyCode>=65). The keyCode being referenced is 190, which is greater than 65, resulting in the code not functioning as expected.

UPDATE

onkeydown = "return ((event.keyCode != 186) && (event.keyCode != 32) && (event.keyCode != 188));"

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

What is the best way to choose multiple values from a dropdown menu and display them as a comma-separated string in a Material Table in React

I am exploring the editComponent feature in React's material table to implement a dropdown that allows users to select multiple options and display them as a comma-separated string. For example, if a user selects option1 and option3, the value disp ...

Utilizing DOMStringMap data to populate CSS URLs

I am attempting to create a universal CSS modification for a webpage element that resembles: <button data-action="link" class="cardImageContainer coveredImage cardContent itemAction lazy lazy-image-fadein-fast" data-blurhash="lo ...

How to disable specific multiple dates in Material-UI datepickers?

Is there a way to disable specific dates on the calendar, not just past or future dates? I want to be able to choose which dates are disabled, such as June 29th, June 27th, and July 4th. I know you can use 'shouldDisableDates' to achieve this, b ...

Encountering errors preventing the utilization of helpers in fancybox2-rails gem

I've been struggling to implement fancybox2 in my RoR app. I've attempted using the gem and manually adding the files to my assets directory, but I'm having issues with the helpers. Currently, the thumb images generated by the helper are no ...

Blip of an image then vanishes

Within my web application, I have implemented code to display images and allow users to navigate through them using Next and Previous buttons. The functionality works as expected, but there is an issue where the image briefly flashes and then disappears wh ...

Is there a way to trigger the second function once the first one has been completed?

When the change event occurs, I am invoking two functions. function1(); function2(); The function1() makes an ajax call. The function2() is running before function1() for some reason. Can anyone explain why this is happening? Any assistance would be ...

How to trigger a function in a parent directive from a child directive

I am working with a child directive named dropDownSortMenu. One of the elements inside this child directive contains an ng-click function. When this function is triggered, I need it to call a function from the parent directive called customTable. You can ...

Exploring WP8.1 features based on specific conditions

Is there a method to incorporate Windows Phone 8.1 features into a project aimed at Windows Phone 8.0 while ensuring compatibility with both versions? ...

JavaScript: Hover Effects and Toggle Functions

My navigation menu is set to hide by default and should only appear when hovered over, however it seems to disappear immediately after showing up. I want the navigation menu to stay visible on hover and then hide again when the mouse moves out of the ele ...

How to take advantage of the onOk method in Vue Ant Design's Modal component

I am currently attempting to utilize Vue Ant's confirmation modal dialog, but I am encountering difficulties in accessing methods and data within the onOk prop. Whenever I try to call my methods or use this.$emit, I receive an error message stating "T ...

The Hydration error is caused by dynamic imports in NextJS v14.2.3

While updating NextJS from v13 to v14, I encountered a Hydration error due to dynamic imports. Is there a way to resolve this issue? const MyComponent = dynamic(() => import('../components/MyComponent')) Is there a fix that allows for both la ...

The jQuery autocomplete feature is malfunctioning, as it is unable to display any search

Creating a country list within an ajax call involves working with an array of objects: $.ajax({ url: '//maps.googleapis.com/maps/api/geocode/json?address=' + zipCode + '&region=AT', type: 'GET', dataType: &apo ...

Issue with styling Icon Menu in material-ui

I'm having trouble styling the Icon Menu, even when I try using listStyle or menuStyle. I simply need to adjust the position like this: https://i.sstatic.net/n9l99.png It currently looks like this: https://i.sstatic.net/WeO1J.png Update: Here&apo ...

Issue with ASP Repeater failing to refresh content post data binding

I'm facing a complex issue with my custom user control called "roster list" that includes an ASP Repeater. The RefreshRosterList method of this control is triggered on Page_Load and it is dynamically added to an UpdatePanel. Within the master page, t ...

window.print function appears multiple times

Looking for help with a sample script I have that prints a section of my website page when a button is clicked. The issue arises when using ajax to transition and clicking the same button results in window.print activating multiple times. How can I ensur ...

When given an input, the initial state will rise from 0.00 to 0.01, and with each subsequent input, it will further increase to 0

My question revolves around managing an input field in React. Initially, the input has a value of 0.00. When a user enters a number, such as 1, the new value should be 0.01. Subsequently, if the user enters another number, for example, 1 again, the updated ...

Vue.js does not have the ability to toggle a font-awesome icon

I am having trouble toggling a font awesome icon based on a boolean value. It seems that the font-awesome icon stays on the screen even after it is drawn: Check out this link for reference HTML: <script src="https://unpkg.com/vue"></script> ...

"Make sure to tick the checkbox if it's not already selected,

Could use some assistance with traversing and logic in this scenario. Here is the logic breakdown: If any checkbox in column3 is checked, then check the first column checkbox. If none in column 3 are selected, uncheck checkbox in column1. If column1 ...

Advantages of using Mocking compared to nUint

I'm a beginner in the testing field and I need to test some C# classes. Can someone please explain what mocking is and why certain mocking frameworks like Rhino Mocks are chosen over nUnit? ...

What is the best way to implement window.load in React Native?

I'm encountering an issue with a simple button on my page in Expo/React Native. When I try to navigate to a new page using window.open upon clicking the button, I receive an error message saying "undefined is not a function." Although I am utilizing ...