jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes How to get Div values in the html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to get Div values in the html" Watch "How to get Div values in the html" New topic
Author

How to get Div values in the html

N Paramas
Greenhorn

Joined: May 08, 2007
Posts: 7
Hi

I need to get a html div values to a java script funtions where i will validate in client side.

My html will look like below
<div id=section>
<div id=item>
<div>
<select name=count>
<option>1<option>
<option>2<option>
<option>3<option></select>
<div><input=text name=ISBN></text>
</div>
<div>some dropdown related to book
</div>
</div>
</div>
</div>

<add button> <remove>
Now I want count, ISBN or count and book title with different combinations. and div section will dymically added when clicking add button and vice versa for delete button.

ANY HELP WILL BE GREAT FOR ME.

THANKS IN ADVANCE



- N Paramas
Seamus Minogue
Ranch Hand

Joined: Jun 24, 2008
Posts: 41
Im not 100% sure I know what you're trying to do. But it seems like you want to get the HTML from within a div and/or dynamically create HTML and insert it into a div?

Use innerHTML
http://www.tizag.com/javascriptT/javascript-innerHTML.php

Hope this helps.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

N Paramas, a few things to help you here on the Ranch:

Firstly, please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .

Also, please read this with regards to posting in all uppercase characters.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
N Paramas
Greenhorn

Joined: May 08, 2007
Posts: 7
Hi All,

My issue is like i need to get the values in the div of the html page and do some validations.




Thanks in advance.



- N Paramas
Seamus Minogue
Ranch Hand

Joined: Jun 24, 2008
Posts: 41
Validations on the contents of a div? Or validation of user input?


If you're trying to validate the HTML which is contained in the DIV then take a look at my earlier post about innerHTML.

If you're trying to do validation of the values of your input fields. This is probably a good place for you to start.
http://www.w3schools.com/js/js_form_validation.asp

There are lots of examples of how to do client side form validation with javascript.

Hope this helps you out.
 
 
subject: How to get Div values in the html
 
Similar Threads
Getting null while trying to get value of Multiple list
Speed up Application Created USing Servlets and JSP
Need help with Jquery
Help needed with DOJO and JSP
jQuery execution