+ 1

How can I take an id of element with textbox and how to insert id to my $("") place?

I have an input, button and I have an p. I want to take id of p from my textbox and when I click the button, the text of p will change. I can take id from my textbox with val() method, but how to insert it to $("what I must write")?

13th Jul 2017, 9:33 PM
Yusuf
Yusuf - avatar
7 Answers
+ 2
thank you even if it is for javascript. Are there anyone who knows jQuery?
13th Jul 2017, 10:14 PM
Yusuf
Yusuf - avatar
+ 1
We get id from p and manipulate it in jquery code. For instance: css. But u can explore it for other purposes. If I understood you correctly... <p id="textarea"></p> $("p#textarea").css({"color": "red", "font-size": "200%"});
13th Jul 2017, 10:20 PM
Mr. Nobody
Mr. Nobody - avatar
+ 1
$( "#"+$(".myTextbox").val() );
13th Jul 2017, 10:25 PM
Andrés04_ve
Andrés04_ve - avatar
+ 1
thank you so so much andres, I don't know why you are getting minus from someone but you are awesome for me :)))
13th Jul 2017, 10:34 PM
Yusuf
Yusuf - avatar
+ 1
You just started jQuery 12 mins ago andres :)))
13th Jul 2017, 10:36 PM
Yusuf
Yusuf - avatar
+ 1
I just started the course but I have a tad of knowledge about jQuery... I used JavaScript logic with jQuery code
13th Jul 2017, 11:06 PM
Andrés04_ve
Andrés04_ve - avatar
0
So you want to use the id in the textbox? I don't know jQuery, but this JavaScript example should help: var textbox = document.getElementById("myTextbox"); var other = document.getElementById(textbox.value);
13th Jul 2017, 10:04 PM
Andrés04_ve
Andrés04_ve - avatar