Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
i just want to paste the content of one textbox to other when i click the button u . but it is not showing.
<html>
<head>
<script src="jquery_min.js">
</script>
<script>
$(document).ready(function(){
$("#button").click(function(){
var ravi=$("#text").val();
$("$text1").val(ravi);
});
});
</script>
</head>
<body>
<input type="text" value="ravi" id="text">
<input type="text" id="text1">
<input type="button" value="u" id="button">
</body>
</html>
You need to use # to target element by id in jQuery, so change:
$("$text1").val(ravi);
to:
$("#text1").val(ravi);
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
My Html is as follow,
<html>
<head>
</head>
<body>
<label>Name : </label>
<input type="text" id="user" />
<button id="submit"> Hit Me !!</button>
</body>
<p id="id1"> This is paragraph which has id1.</p>
<p id="id2"> This is paragraph which has id2.</p>
<button id="change"> To Change Color !!</button>
</html>
This is just a small portion of my code and I have lots of button tags in my HTML.
I want to put all the buttons in the center of screen (Horizontally).
I have also created same CSS for all buttons.
So what to write in that CSS, so I can get all the buttons in center ?
button{
margin-left:auto;
margin-right:auto;
}
in your CSS file for all buttons
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
<div class="input-group mb-3">
<input type="text" id="txt" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="button-addon2">
<button class="btn btn-outline-secondary" type="button" id="btn">ver</button>
</div>
</div>
<script>
var botao = document.getElementById('btn');
var texto = document.getElementById('txt');
botao.addEventListener('click', function() {
var s = texto.legth;
window.alert(`${s}`);
})
</script>
A couple of issues,
texto is an input, so you need to access .value to get the value in that input.
a spelling error on the .length property, you have legth (missing the n)
so
var s = texto.value.length;
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Photo of the website
I have a school project and I need to make a website where I can add more balance to my account. But I can't figure it out.
I would like to make an HTML number input and then that input needs to add up with my existing balance. But I can't make it work
This is the code I have:
<fieldset>
<legend>Opwaarderen</legend>
<input type="number" id="opwaarderen">
<input type="submit" onclick="opwaarderen()">
</fieldset
But how can I make the Javascript function? So that the input will add up to my already existing balance.
This will help
var currentCredit=0;
$("#a").click(()=>
{
alert(currentCredit+=Number($("#opwaarderen").val()));
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<fieldset>
<legend>Opwaarderen</legend>
<input type="number" id="opwaarderen">
<input type="submit" id="a">
</fieldset>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am trying to fetch the value of an input box and displaying that value dynamically using jquery .
The code works fine and loads the image on the check id.
But the value of user_id is not being displayed on <p>
The code is as follows :
<input type="text" autocomplete="off" name="user_id" id="user_id" class="user_name" >
<button>Check</button>
<span class="check" ></span> <br/>
<p> </p>
$(document).ready(function(){
$("button").click(function(){
$('.check').show();
$('.check').fadeIn(400).html('<img src="image/ajax-loader.gif" /> ');
var us=("#user_id").val();
$("p").text(us);
});
});
You missed the $ sing:
$("button").click(function(){
$('.check').show();
$('.check').fadeIn(400).html('<img src="image/ajax-loader.gif" /> ');
var us= $("#user_id").val();
$("p").text(us);
});
Working Example
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I can't find my error. I looked at the other topics but no luck.
<div>
<input id="date1" name="date1" type="date">
<input id="date2" name="date2" type="date" onchange="date()">
<input id="date_diference" name="date_diference" type="date">
<script type="text/javascript">
function date(){
document.alert("hope to work");
}
</script>
</div>
this won't work:
document.alert("hope to work");
this will
alert("hope to work");