ms.tery
ms.tery

Reputation: 149

how to get the title attributes in my lvrow in javascript

im trying to get the title in function getProj(lvrow). but i dont know whats wrong in my javascript.

heres my javascript

function getProj(lvrow){ 
    var btnhd = document.getElementById("hdField");
    btnhd.value = $(lvrow).data("title") // in this part the program always stop
    document.getElementById("getProj").click();
} 

Thanks.

Upvotes: 1

Views: 37

Answers (2)

Yosvel Quintero
Yosvel Quintero

Reputation: 19070

HTML DOM title Property:

var titleAttr = document.getElementById('myAbbr').title;
console.log(titleAttr);
<p>
  <abbr id="myAbbr" title="World Health Organization">WHO</abbr> was founded in 1948.
</p>

In your function, once you get the element by id, you can directly access to its property title:

function getProj(lvrow) {
    var btnhd = document.getElementById("hdField");
    document.getElementById("getProj").click();

    // Element's property title
    console.log(btnhd.title);
}

Upvotes: 1

Mr.7
Mr.7

Reputation: 2713

as far as i understood, lvrow is your project object and it has title property.

function getProj(lvrow){ 
    var btnhd = document.getElementById("hdField");
    btnhd.value = lvrow.title;
    document.getElementById("getProj").click();
} 

Hope this helps :)

Upvotes: 2

Related Questions