Solved

Javascript DOM objects

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now