• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Div values in the html

 
N Paramas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
N Paramas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic