KeyPad numbers in javascript on click event [closed] - javascript

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have this created a page with numbers and textbox in top of it as you see in the picture
The element id of the textbox is t1
the question is , what's the code I should write on click event to make the numbers written on the textbox .
For example , when I click (1) three times , the textbox should have the value of ( 111 )
any advices ?

JavaScript:
function display(val)
{
document.getElementById("t1").value+=val
}
HTML:
<input type="button" value="1" onclick="display('1')"/>
<input type="button" value="2" onclick="display('2')"/>
<input type="button" value="3" onclick="display('3')"/>
And so on..
display() will call the function to display the value what has been clicked.

Related

How can I get the value of the checkbox in PHP? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
I am trying to make a registration page for my website but when I run it; it gives error. What am I doing wrong?
<?php
//Form values
$name_value=$_POST['Name_input'];
$Username_value=$_POST['Username_input'];
$DOB_value=$_POST['DOB_input'];
$Password_value=$_POST['Password_input'];
$Phone_number_value=$_POST['Phone_number_input'];
$Python_checkbox_value=$_POST['Python_checkbox'];
$Java_checkbox_value=$_POST['Java_checkbox'];
$C_sharp_checkbox_value=$_POST['C#_checkbox'];
$HTML_checkbox_value=$_POST['HTML_checkbox'];
$Cpp_checkbox_value=$_POST['C++_checkbox'];
$R_checkbox_value=$_POST['R_checkbox'];
$swift_checkbox_value=$_POST['swift_checkbox'];
$kotlin_checkbox_value=$_POST['kotlin_checkbox'];
$JS_checkbox_value=$_POST['JS_checkbox'];
Take a look at this code :
<form method="GET">
<input type="checkbox" value="value" name="name">checkbox label</input>
<input type="submit">
</form>
<?php
if (isset($_GET["name"]))
{
echo $_GET["name"];
}
?>
As you can see when I submit the form without checking, the parameter in URI is empty because the checkbox isn't defined (I used GET method)
But when I check it, you can see the parameter is name=value

Disable only checked checkbox in a table [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
So I have been working on a system and I can't seem to solve how to disable only the checked checkbox inside a table. I have been looking everywhere but no answer. Would you mind helping me?
For example, I have three rows in my table and whenever I check a row all three checkbox will be disabled. What I want is, I only want the checked checkbox in the row to be disabled and the other two should be enabled.
You can add an event handler to your checkboxes like this:
var disable = function(event){
$(event.target).prop("disabled", true);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" onchange="disable(event)" />
<input type="checkbox" onchange="disable(event)" />
<input type="checkbox" onchange="disable(event)" />

Get selected radio item true OR false [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I was trying to get weather the radio button is selected or not by Jquery, but it always returns me false even if the id is checked
So far i tried this:
$("#opt_34709").prop('checked');
This is my HTML:
<input type="radio" id="opt_34709" value="119740" name="options[34709][]">
In this little fiddle I provided two more radio button options. Each time you click on one of the radio buttons you will be shown the value of the first radio button. I hope this helps.
$(':radio').click(function(){
console.log($("#opt_34709").prop('checked'))
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="radio" id="opt_34709" value="119740" name="options[34709][]">09<br>
<input type="radio" id="opt_34710" value="119741" name="options[34709][]">10<br>
<input type="radio" id="opt_34711" value="119742" name="options[34709][]">11

Javascript - Clear search output when submitting another text input [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
For my project I need to create a simple search engine for my webpage.
I need a way to clear my previous search results when I submit another search into the form without refreshing the entire page.
My Javascript file contains the objects I am searching for.
HTML:
<form>
<div class="form-group">
<input id="term" class="form-control" type="text">
</div>
<button id="search-button" class="btn btn-default" type="button">
Search</button>
</form>
<div id="results-area"></div>
Correct me if i'm wrong:
Code with jQuery:
$(form).submit(function(e){
$("#results-area").html("");
})
Using jQuery it would go like this:
$("#search-button").click(function(){
// your search function here
$("#term).val('');
});

Using ajax/jQuery to update a list on button click [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm just wondering if anyone can point me in the right direction on how to create a dynamic list on a webpage based on user entry without refreshing the page each time.
For instance, a user would:
type a word into a textbox
click a button
the word would show up somewhere else on the page
the word would be erased from the textbox
Any new word typed would automatically be written underneath any previously entered words.
<div id="target"><div>
<input type="text" id="newInput" />
<input type="button" id="saveInput" />
<script>
// when button is pressed:
$('#saveInput').on('click', function(){
// check if something is there
if( $('#newInput').val().length !==0){
$('#target').append('<div>'+ $('#newInput').val()+'</div>'); //append to a target
$('#newInput').val(''); // empty input
$('#newInput').focus() // for bonuspoint, place cursor back in input
}
});
</script>
If you want each new entry as first listitem, use prepend() instead of append()
Here's an working example:
Html:
<input type="text" id="txtWord"/>
<input type="button" id="btnAddWord" value="Add new word" />
<ul id="words">
</ul>
Script:
$(document).ready(function(){
$('#btnAddWord').bind('click', function(){
if( $('#txtWord').val() !== ""){
$('#words').append('<li>'+ $('#txtWord').val()+'</li>');
$('#txtWord').val('');
}
});
});
Example
http://jsfiddle.net/AfNgH/

Categories