Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by ank5
at 2024-08-12 21:58:32
Point:300 Replies:3 POST_ID:828741USER_ID:11616
Topic:
JavaScript;;Hypertext Markup Language (HTML)
I'm trying to set value of html field using Javascript -
HTML
HTML
Javascript
This works fine. Only problem is that the control where value is set, I don't want it to be an input field but something like a label. Is that possible?
Assisted Solution
Expert: julianH replied at 2024-08-13 02:00:06
50 points EXCELLENT
You can also look at JQuery
To change a non-form element
To change a non-form element
<script src="http://code.jquery.com/jquery.js"></script><script type="text/javascript">$(function() { $('#changeLable').click(function() { $('#test').html('New Value'); });});</script>...<label id="test">Old Value</label><input type="button" id="changeLable" value="Change Lable" /> 1:2:3:4:5:6:7:8:9:10:11:
To change a form element
<script src="http://code.jquery.com/jquery.js"></script><script type="text/javascript">$(function() { $('#changeValue').click(function() { $('#test').val('New Value'); });});</script>...<intput type="text" id="test" value="Old Value"/><input type="button" id="changeValue" value="Change Value" /> 1:2:3:4:5:6:7:8:9:10:11:
Accepted Solution
Expert: duncanb7 replied at 2024-08-12 22:42:50
200 points EXCELLENT
document.getElementById("test").value= 'myname'; that is not working
and how about using innerHTML instead of value ?
document.getElementById("test").innerHTML = 'myname';
or $("#test").text("myname");
and how about using innerHTML instead of value ?
document.getElementById("test").innerHTML = 'myname';
or $("#test").text("myname");
<label id="test" for="something">Something</label>
Assisted Solution
Expert: bigeven2002 replied at 2024-08-12 22:08:58
50 points EXCELLENT
Hello,
I found a similar question here and the link below is what one of the users on that site posted.
http://jsfiddle.net/mendesjuan/VBVtE/3/
On the example, when you toggle the status between Retiree and Employee, the next field label dynamically changes. Is this similar to what you are looking for?
I found a similar question here and the link below is what one of the users on that site posted.
http://jsfiddle.net/mendesjuan/VBVtE/3/
On the example, when you toggle the status between Retiree and Employee, the next field label dynamically changes. Is this similar to what you are looking for?