-3

To make a search tab I have executed the following:

<form>
   <input type="text" name="search" placeholder="Search..">
</form> 

However if I want to search another element from the same html page like say a paragraph named "123" using this search tab how can I proceed?

Jones Joseph
  • 4,703
  • 3
  • 22
  • 40
anonymous
  • 3
  • 2
  • Your question is not clear. Please put a snippet. – serkan Jun 05 '17 at 08:06
  • You are asking if how to search another element either with an `ID`, a `name` or a `class` using an `input`, right? – Carl Binalla Jun 05 '17 at 08:07
  • Yeah to search any element using the input element – anonymous Jun 05 '17 at 08:14
  • I believe you need to use JavaScript for this task: `document.querySelector('input[name=search]').addEventListener('input', function(event) { console.log(document.getElementById(event.target.value)) })` – Egor Stambakio Jun 05 '17 at 08:26
  • Can you tell me where to add this java command in the html script, like after the form tag or the input tag or so on? @wostex – anonymous Jun 05 '17 at 09:02
  • @anonymous this is too broad question, you should learn a whole programming language in order to to that. You'd better find a javascript programmer and give him a precise task. And remember, javascript in not java, these things are totally different. – Egor Stambakio Jun 05 '17 at 09:15
  • Ok thank you for the help. Will surely look forward to learning what all of these terms are. @wostex – anonymous Jun 05 '17 at 10:41

1 Answers1

0

pretty simple please give a 5 rating to this answer !!!

input[type=text]
{
background-color:green;
font-size:40px;
}
input[type=email]
{
background-color:red;
font-size:40px;
}
<form>

<input type=text placeholder="i an text and i am green"><br>
<input type=email placeholder="i an email and i am red"><br>


</form>
laxit
  • 18
  • 1
  • 6