The event.target.value is not insert the userinput into a variable

The event.target.value is not insert the userinput into a variable

Content Index :

The event.target.value is not insert the userinput into a variable
Tag : javascript , By : Puneet Madaan
Date : December 05 2020, 12:18 PM

like below fixes the issue You can use the below snippet and keep in mind that target of the event is what you put the click event on. so the target will be the submit button which you don't want. also target.value only works on the target not in any other element in the DOM
    const myinput = document.getElementById('myinput');
    const mytext = document.getElementById('mytext');
    const submitButton = document.getElementById('submit');

    submitButton.addEventListener("click", function(event){
       const textInput = myinput.value;
       const textArea = mytext.value;
       alert(`the text Input: '${textInput}' and the text Area: '${textArea}'`);
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
input[type="text"] { 
  width: 200px;
  height: 20px;

input[type="submit"] { 
  width: 100px;
  height: 50px;

        <form action="" id="myform">
                <input type="text" id="myinput"/>
                <textarea id="mytext" cols="30" rows="10"></textarea>
                <input type="submit" id='submit' />
<script src="script.js"></script>

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How to use variable in target database name for insert statement?

Tag : sql , By : user181445
Date : March 29 2020, 07:55 AM
To fix the issue you can do I've had this problem before and the only work around I found is dynamic sql
declare @machine nvarchar(6)
declare @bar nvarchar(3)
declare @sql varchar(2000)
set @machine = 'Name00'
set @bar = 'foo'

Set @sql ='insert into ' + @machine + '.dbname.dbo.table (column1, column2)
select (column1, column2)
from table
where column1 = ''' + @bar + ''''

--print (@sql)
exec (@sql)

Using a userinput as a variable in an If statement in BAT

Tag : batch-file , By : Alan Little
Date : March 29 2020, 07:55 AM
I hope this helps you . , The entire IF statement must reside on one line
@echo off
set /p a=Enter 1,2,3:
if %a%==1 echo you entered 1
if %a%==2 echo you entered 2
if %a%==3 echo you entered 3
@echo off
set /p a=Enter 1,2,3:
if %a%==1 (
  echo you entered 1
if %a%==2 (
  echo you entered 2
if %a%==3 (
  echo you entered 3
@echo off
set /p a=Enter 1,2,3:
if %a%==1 ^
  echo you entered 1
if %a%==2 ^
  echo you entered 2
if %a%==3 ^
  echo you entered 3

Try to trigger the event in javaScript by userinput

Tag : javascript , By : helloedwin
Date : March 29 2020, 07:55 AM
Any of those help Newbie for JavaScript here. I tried to write a program that when a user types in "F" in the text, the hidden ball shows up. However, it just does not work. Hope someone could help me out. Thank you in advance. Here my html, css, js below:- , I've done it here. Hope this helps.
// if you do not care whether the 'F' is capital or simple
/*$('#input').keydown(function(e) {
  if (e.keyCode == '70') {
  } else {

// if you care whether 'F' is capital or simple
$('#input').keyup(function() {
  if ($('#input').val() == 'F') {
  } else {
.ball {
  background-color: red;
  border-radius: 100%;
  height: 50px;
  width: 50px;
  margin-top: 50px;
  display: none;

.ball.shown {
  display: block;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<input id="input" type="text">
<div id="ball" class="ball"></div>
if(textInput = "F") 
if(textInput == "F")

Two dimensional Array passing to print after taking values but output doesn't reflect the correct userinput ?? UserInput

Tag : java , By : static AG
Date : March 29 2020, 07:55 AM
Hope that helps
constantGameBoard.rowcolumnNumber has been neglected , this is the issue. Now it's resolved

public static void userInputOnBoard(int numberRC, int row , int column ) {

        for(int i = 0 ; i < constantGameBoard.rowcolumnNumber ; i++)
            System.out.println("print 1" + "value i " + i);
            for(int j = 0 ; j < constantGameBoard.rowcolumnNumber ; j++)
                System.out.println("print 2" + " value j" + j);
                if( i == row && j == column)
                    System.out.println("print 3");
                    if(numberRC == 1)
                        System.out.println("print 4");
                        constantGameBoard.inputArray[i][j]= 1;
                        System.out.println("print 5");
                        constantGameBoard.inputArray[i][j]=0 ;




event.target.toString() or event.target.nodeName to check type of element

Tag : javascript , By : Jason Vance
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Use .nodeName. It is well supported, fast and is the standard approach.
Also, you don't need .toLowerCase(). The .nodeName is guaranteed to return an uppercase string, at least for standard elements, so change your comparison to this:
e.target.nodeName === "BUTTON"
Related Posts Related QUESTIONS :
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • How can I effectively curve my items inside a list?
  • Add new record Keyboard Shortcut on Kendo Grid Mvc
  • Time and Date running on page
  • Looping through page links puppeteer doesn't return values from the newly loaded page
  • Problem with Navigator.geoLocation.getCurrentPosition not working
  • Trying to change the id of an element with Javascript
  • Embedded Schema Inserting Blank in Meteor using Collection2
  • avoid useEffect to render at first load?
  • Why is this CSS transition only working correctly on the some clicks? How to solve it?
  • Interpolated values does not reflect the latest values in an Angular app
  • Javascript classes define attribute in constructor or outside the class
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com