Answer the question
In order to leave comments, you need to log in
Chrome extension how to get value from block div?
Good time and day.
Question from a newbie:
I'm writing an extension for Chrome. It is necessary that when the extension button is clicked, it receives data from the html page and displays it in alert
Sample page code
<div class="smallfont post-title">
<strong>Получить значение дива по class</strong>
</div>
{
"manifest_version": 2,
"name": "superpuper",
"description": "yop yop",
"version": "1.0",
"browser_action": {
"default_icon": "calc.png",
"default_title": "yopyop"
},
"icons": { "16": "calc.png",
"48": "calc.png",
"128": "calc.png" },
"permissions": [
"tabs",
"activeTab"
],
"background": {
"scripts": ["background.js"]
}
}
function onExtensionClick() {
var a = document.getElementsByClassName('post-title')[0].innerHTML;
alert("a");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question