Solved

Javascript DOM objects

Posted on 2015-01-22
5
135 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

717 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