1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[js] title setter

This commit is contained in:
Witold Filipczyk 2021-06-03 14:05:00 +02:00
parent 4270cb3125
commit 040ab5a189
2 changed files with 16 additions and 1 deletions

View File

@ -1632,6 +1632,14 @@ element_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
if (!el) {
return true;
}
std::string value = JS_EncodeString(ctx, args[0].toString());
el->set_attribute("title", value);
return true;
}

View File

@ -9,10 +9,17 @@
<script>
function aa()
{
// alert(document.getElementById('blabla').title);
alert(document.getElementById('ble').title);
}
function bb()
{
document.getElementById('ble').title = 'BLEBLE';
aa();
}
</script>
<button onclick="return aa()">Click me!</button>
<button onclick="return bb()">Change title of element</button>
</body>
</html>