• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get Div values in the html

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic