Solved

Javascript DOM objects

Posted on 2015-01-22
5
128 Views
Last Modified: 2015-01-30
Can pure text objects be accessed and have properties manipulated by Javascript?

See attached. This is now all managed by php but due to performance issues in the field with no WiFi, I want to do it in Javascript

Note the text box labeled "Search Parts" with the word "Box" typed into it. When the search button is clicked, it searches all parts with the word "Box" contained within the part description. After the search, it displays the items to the right; including text & form elements.

Can I identify the text elements with an id and use visible / hidden properties?

Or many just inclose the whole thing in a div with an id & make the div visible or invisible?

Thanks
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 40564791
The text inside an html tag can be accessed via object.innerHTML in javascript.

InnerHTML represents a child node of the parent object (html tag), so the text itself cannot have an id, but the parent tag can. Access the text node as described above.

Attachment?
0
 

Author Comment

by:Richard Korts
ID: 40564822
@Tom Beck,

Sorry, forgot attachment.

So if I put a div tag around the whole thing, including the text, & give the div an id, I can apply hidden or visible property to the div?

Thanks
parts-search.jpg
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 40564940
Correct. See if this example helps.

jsfiddle.net/tommyBoy/w4yycum2/2/

Not sure how this applies to your situation however. I guess I'd have to see how the information for the various form fields is arranged in the markup.
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 40565214
Hi,
not sure if this helps, but what about a nice Javascript library like Datatables.net (http://www.datatables.net/).
It is quite flexible and needs "just" jQuery and itself as plugin.
At least it has a really nice search and filtering.
Just my 2ct
Rainer
0
 

Author Closing Comment

by:Richard Korts
ID: 40580949
Excellent, works beautifully.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Understanding UserAgent String 2 49
Can't get js code to execute 8 33
Video Tutorial help 2 40
how to customize the text in the legend in highcharts 3 36
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question