Solved

Javascript DOM objects

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

896 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

11 Experts available now in Live!

Get 1:1 Help Now