kitokid kitokid - 6 months ago 26
HTML Question

how to get value of HTML from jquery or javascript

I want to select the following three values from the HTML file either by Jquery or Javascript.

  1. class "class1" href value

  2. class "class1" inner text value (PersonA in the example code)

  3. class "Title" inner text value (Accountant in the example)

How can I select all the data of li node by node as? I am lost :(

<ol id="result-set">
<li id="v-0">
<div class="result-data">
<a class="class1" href="">PersonA</a>
<dl class="basic">
<dd class="title">Accountant</dd>
<li id="v-1">


To get "PersonA": $('#v-0 h2 a').html();

To get href of that link: $('#v-0 h2 a').attr('href');

To get "Accountant": $('#v-0 dl dd').html();

You can modify the id ("v-0") at the start of the selector to choose a particular "row" of your data set.