get a variable from a textarea in javascript [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 8 years ago.
Improve this question
here is what i'm doing but it doesn't work. I have to change the texte in the textarea but I don't know how to get it? thanks
<%
/** Variables */
String valeurTexte;
/** Logique */
valeurTexte = request.getParameter("texte");
valeurTexte=valeurTexte.replaceAll("Ç","Ç");
out.println("Votre texte: "+ valeurTexte);
%>
<form>
<textarea name="texte">ici</textarea>
<input type='submit'>
</form>
</body>
</html>

It's hard to see exactly what you want from the question, but assuming this is javascript because of the tag, give the textarea an id and do document.getElementById("myId").innerText=sometext
or document.getElementsByName("texte") and find the textarea

Related

Can i somehow insert number multiple times into 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 10 months ago.
Improve this question
this code while i click two times: 2
what i need: 11
<div id='one'></div>
<input type="number" id='pin'/>
<script>
document.getElementById('one').onclick = document.getElementById('pin').setUp(1);
</script>
<div id='one'></div>
<input type="number" id='pin'/>
<script>
var one = document.getElementById('one');
var pin = document.getElementById('pin');
one.onclick = function(){
pin.value = pin.value + '1';
}
</script>

How to show Javascript variable inside input box ,so that i cant post it in html form? [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 years ago.
Improve this question
http://jsfiddle.net/t32h0gj4/4/
how to show variable inside input box<b id="smsCount"></b> SMS (<b id="smsLength"></b>) Characters left
<br />
<input type= "text" id= "smsCount" ></input>
<textarea id="smsText" style="width:400px;height:200px"></textarea>
Please help me
Fixed: http://jsfiddle.net/t32h0gj4/5/
Changes:
HTML: change id="smsCount" to class="smsCount" (id's need to be unique)
JavaScript: change the selector to .smsCount and further below also call the jQuery .val() function to set the input box.

please tell me what is wrong with this simple code [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 years ago.
Improve this question
I am new to html. I am trying to get time but the code is not working in browser. please help
<h1>My First JavaScript</h1>
<button type="button"
onclick="document.getElementByid('time').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="time"></p>
</body>
</html>
Typo in your code,
document.getElementByid('time')
should be:
document.getElementById('time')
(you miss the i capital)
For simple debugging like this, you can use the console of your web browser. Just hit F12, and look into the console, the error will be described here.
There is a typo here:
document.getElementByid
should be
document.getElementById
Working example here.
Please fix that line :
document.getElementByid('time')
and change it to
document.getElementById('time')
<button type="button"
onclick="document.getElementById('time').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="time"></p>
You spelt getElementById wrong
Please Change Next line:
document.getElementByid('time')
to:
document.getElementById('time')

How to insert <li> element on <ul> using pure javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I am having an issue with javascript and i don't know how to solve it ...
Actually my code is working good with jsfiddle, but when i try to insert on my HTML page ,it simply doesnt work anymore ...
What i want to, is to add the < li> on < ul> each time i tried to hit the button named "Add" !
HTML code:
....
<td width="50%" valign="top">
<b> SUPER: </b>
<ul id="ul">
</ul>
</td>
....
<input type="submit" value="Add" onclick="add()"/>
....
JavaScript code:
<script type="text/javascript">
function add(){
var ul = document.getElementById("ul");
var li = document.createElement("li");
li.innerHTML = "LoL";
ul.appendChild(li);
}
</script>
The result with that code : it doesn't add anything on my HTML page when i try to hit the button...
Thankfully,
May be oversimplifying this, but here's a thought: Your input button is a SUBMIT, so when the onClick performs, the submit happens immediately thereafter, restoring the page to its original state. The process happens so quickly the appearance is that the code did nothing.
Just change the input type to "button", eg
<input type="button">

Load php function onClick [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Javascript
$("#ReadTok").click(function(){
$("#tokentype").load('../process/read_token_type.php');
});
HTML
<input type="button" id="Readtok" value="Read Token" />
<span id="tokentype"></span>
PHP
echo $PartType;
This has worked perfectly for me before why is it not working now.
What am I doing wrong?
Replace your javascript with this one
$("#Readtok").click(function(){ //here t is small letter in ReadTok
$("#tokentype").load('../process/read_token_type.php');
});
Because your button id is id="Readtok"
A typo error. ReadTok vs Readtok
$("#ReadTok").click(function(){
$("#tokentype").load('../process/read_token_type.php');
});
Your ID and Function Selector Name is mismatch thats the problem correct it sure it will work
$("#Readtok").click(function(){
$("#tokentype").load('../process/read_token_type.php');
})
Here one solution.
<Html>
<script type="text/javascript">
$(document).ready(function () {
$("#Readtok").click(function () {
$("#tokentype").load('../process/read_token_type.php');
});
});
</script>
<head>
</head>
<body>
<input type="button" id="Readtok" value="Read Token" />
<span id="tokentype"></span>
</body>
</html>
I hope to help
the id attribute is case sensitive so Readtok and ReadTok are different
either change your javascript to this :
$("#Readtok").click(function(){
$("#tokentype").load('../process/read_token_type.php');
});
or else chage id :
id="Readtok" to id="ReadTok" without altering your javascript

Categories

Resources