0
How to make it? When i click the underline it will underline the word.
13 Respuestas
+ 2
You can find more here for js
https://www.javascripttutorial.net/javascript-dom/javascript-classlist/
+ 5
Oh it was not working when clicked very first
You can do it as
function Underline()
{
var u = document.getElementById("txt").value;
document.getElementById("t").innerHTML = u ;
document.getElementById("t").style.textDecoration = "underline ";
}
+ 3
See if want to show only those effect which is button for,
You can add additional action to the function.
Like when click highlight remove bold,italic,underline,strike
It will show you only that effect.so you can try that also
To remove all effect first and then apply the mentioned one.
+ 2
I think underline is working good
Explain it if any....
You xan set placeholder instead of value for input.
+ 2
You can have a variable holding the element of ID "t". Then have the variable do style.textDecoration("underline") and assign u to its innerHTML.
Like:
var z = document.getElementById("t");
z.style.textDecoration = "underline";
z.innerHTML = u;
+ 2
Sorry if you don't know classlist 's method in js
I have used that
https://code.sololearn.com/W3CeBGeKBtSt/?ref=app
+ 1
Ok,thank you so much ❤️
+ 1
For highlight also can use this method?
+ 1
function Highlight()
{
var h = document.getElementById("txt").value;
document.getElementById("t").style.backgroundColor = "yellow";
document.getElementById("t").innerHTML = h ;
}
+ 1
Thanks. Because i google the remove method got many type. This help me a lot!
0
Because when i use this method it can work but when i click highlight button first then click the underline button it will show out underline and highlight
0
Can give me some example?
0
Ok ❤️