Using keyboard events such as onkeyup and onblur to simulate keyboard entry in JavaScript

I'm currently working on automating the input of a betting amount on a bookmaker's betslip. Here is the code I'm using:

<input id="slip_sgl_stake95274901L" type ="text"     
onblur="document.betslip.single_stake_onblur(this,'95274901L') onkeyup =
"document.betslip.single_stake_onkeyup(this,'95274901L')" size ="7" maxlength="15" value="">

I've been experimenting with C# and .Net, but so far haven't had much success, despite trying various approaches. Specifically, I've tried:

wb.Document.All["slip_sgl_stake95274901"L].SetAttribute("value", betAmount + "");
object[] parameters = { wb, spanID.ToString() + "L"};
wb.Document.InvokeScript("document.betslip.single_stake_onkeyup", parameters);
wb.Document.InvokeScript("document.betslip.single_stake_onblur", parameters);

Where 'wb' represents the web browser instance.

Although the amount gets entered, it appears that these functions are not functioning as expected. Can anyone offer insight into what might be going wrong?

Answer №1

There appears to be an error in the attribute name used, it should be onblur and not onnblur. Please verify this.

Thank you, BHAVIK GOYAL

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 causes additional method calls in an element's attributes to be triggered when using ng-click in AngularJS?

Currently delving into the world of angularJS, I find myself perplexed by the scenario where multiple methods are triggered even though only one is explicitly called. The line in question looks like this: <li ng-repeat="i in names" style="position: re ...

Using setTimeout to click and hold on an element in Javascript

I am in need of adding a feature to my web app where a specific action is triggered when the user clicks and holds on an element, similar to the long press on Android. Here is the HTML code for my div: <div id="myDiv" onmousedown="press()" onmouse ...

The class 'System.String' does not have a default constructor when deserializing JSON

For some reason, I am encountering an issue when attempting to deserialize basic JSON into a managed type. The error message states: MissingMethodException No parameterless constructor defined for type of 'System.String' While it is a kno ...

Transitioning to TypeScript has brought the promise of imports returning once again

I've been facing some challenges while migrating my extensive project to TypeScript, particularly with handling imports. Being relatively new to programming, I'm unsure if my previous approach was considered bad practice. Previously, I organized ...

The error message "TypeError: window.Razorpay is not a constructor" indicates that

I am attempting to integrate RazorPay into my React app, but I am encountering the following error: https://i.stack.imgur.com/iFvdz.png Here is the code snippet: import TshirtImg from "./tshirt.jpg"; // import Razorpay from 'razorpay' ...

Locking state object and properties as read-only in ReactJS/Typescript

I have an object from a third-party class and I want to ensure that its properties are read-only. This means that I do not want to be able to change the state with this.state.object.props = "xx"; The structure of the object is as follows: class ThirdPart ...

Set restriction on the total number of records permitted in a mongodb database

My MongoDB collection is filled with documents, and I want to impose a storage limit of 100 documents. Once this limit is reached, new documents should not be able to be stored. I came across capped collections, but they are not suitable due to the restric ...

Enter the previous script type

Uncertain about the type to assign here. "HowitterObject" in setHowitters represents data and "...prev' is the ongoing accumulation of data from howitterObject. interface IhowitterMessage { message: string; createAt: number; id: ...

What is the best way to retrieve the download folder path for the Chrome browser using Selenium?

Currently, I am working on automating a script in C# Selenium that involves downloading an Excel file using the Chrome browser. After downloading the file, I need to verify the data by opening it. The challenge I am facing is that I cannot rely on the defa ...

What is the best way to organize an Express application that handles both API requests and views?

Currently, I am in the process of developing a small application that will function as both a website and its API. To achieve this, I am utilizing Node, Express, and Webpack. The structure of my directory is organized as follows: >client |>dist ...

Grunt Pokes at XML to Set a Variable Destination Name

When using grunt-xmlpoke to update an XML file, the path of the XML file is provided as a parameter. The issue arises when the first WebConfigPath (key) in the files section is interpreted as a string. This results in updating a local copy of the XML fil ...

You cannot inherit from ASP.NET ListView in this instance as it does not extend the class 'System.Web.UI.UserControl'

I'm currently working on developing a unique custom control that is based on System.Web.UI.WebControls.ListView. Here's the code I have so far: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web ...

What are some strategies for preventing unused setState functions in React? Is it possible to create a React useState without a setter function

Currently working on reducing or eliminating npm warnings related to the React site. Many of these warnings are due to the setState function, which is marked as 'unused' in the code snippet below. const [state, setState] = useState('some st ...

Ways to utilize ng-options for looping through an array inside an object?

How do I utilize ng-options to fill a select element with the content of the "categories" arrays inside the objects? { title: "Star Wars", categories: ["Technology", "Adventure", "Coding"] }, { title: "Street ...

"Implementing a JavaScript function to dynamically add multiple div elements to a

I am just starting to learn JavaScript. The main div with the ID "row_logic" contains two nested divs. I need help figuring out how to dynamically increment this root div in the format shown below using JavaScript. <div class="row-fluid" id="row_log ...

Error encountered when importing a Material-UI component: Unable to load a module from @babel/runtime

Struggling to compile the index.js file with rollup: import React from "react"; import ReactDOM from "react-dom"; import Grid from "@material-ui/core/Grid"; ReactDOM.render( <React.StrictMode> <Grid conta ...

A ReactJS Error occurred: {error: 400, reason: "Failed match", message: "Failed match [400]", errorType: "Meteor.Error"}

I encountered an issue while attempting to send form data to the server when clicking on the Next Button in a Wizard Form. The error that occurs is related to an "Undefined User" warning displayed in the Console during Step 1 of the form submission: " { ...

Prevent the ability to reload and use the F5 key on my PHP page

Currently, I am utilizing a timer on my PHP page. However, whenever someone refreshes the page, the timer resets from the beginning. I am looking for a solution to disable the ability to refresh the page using F5 or reload options within my PHP page. Appr ...

Standardize API data for utilization in Redux

I have an API that provides the following data: const data = { id: 1, name: 'myboard', columns: [ { id: 1, name: 'col1', cards: [ { id: 1, name: 'card1' }, { id: 2, name: 'card ...

Best Practices for Handling WCF Service Exceptions

My current project involves developing a distributed application that includes roles and sets of permissions that require validation. Is it advisable to handle unauthorized access by throwing an exception, or would it be better to send a message back t ...