The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Using the <input> tag, Two <input type="text"> tags on the same page.
Rayj00
post Jun 1 2020, 12:46 PM
Post #1





Group: Members
Posts: 6
Joined: 1-June 20
Member No.: 27,369




I admit I am not a seasoned website developer, so have mercy on me! smile.gif

So, I have two <input type="text"> on the same page.

Here is the first one:

CODE
<input type="text" id="broadcast-id" value="room-xyz" autocorrect=off autocapitalize=off size=20>
<button id="open-or-join">Open or Join Broadcast</button>

And here is the second one:

CODE
<div>
              <h2>Messages</h2>
              <ul></ul>
      </div>
  <form action="">
    <input class="msgs" type="text" id= 'msgs' />
  <button>Send</button>
  </form>


So the first one works fine. But the second one grabs the text from the first one instead of what is typed in it's own text box.

I am using some sample code to add a messaging option in the page from https://www.ably.io/concepts/socketio

Any ideas why the second input is grabbing the first input text?

Thanks, appreciate your response.

Ray



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
CharlesEF
post Jun 2 2020, 12:51 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Christian J, The 1st post showed the input with the class 'msgs', which is not 'msg'. The OP changed the HTML when he posted the 2nd example.

This post has been edited by CharlesEF: Jun 2 2020, 12:53 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Rayj00
post Jun 3 2020, 12:46 PM
Post #3





Group: Members
Posts: 6
Joined: 1-June 20
Member No.: 27,369



QUOTE(CharlesEF @ Jun 2 2020, 01:51 PM) *

Christian J, The 1st post showed the input with the class 'msgs', which is not 'msg'. The OP changed the HTML when he posted the 2nd example.


Like I said, I am very green when it comes to html. If you can, please advise how I use the <input type=text> along with the subsequent document.querySelector.

I will continue to research and experiment in the meantime.

Appreciate it,

Ray

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 10:26 AM