google chrome - Use `inspect an element` tool to make global Javascript variable -
in modern browsers (and firefox + firebug) can open developer tools , either go html/elements tab, or can inspect element interactive dom display.
you can heaps of useful stuff here, , 1 thing need manipulate/interact particular element using javascript (in console tab).
what i've been doing using interactive dom add id attribute 'bob', doing whatever need in console document.getelementbyid('bob') (or $('#bob')).
ideally i'd right click on element , select option make js variable in console can use variable called bob,
does know of such hidden feature/addon/faster method?
use built-in xpath context menu shortcut. here process:
- right click on element within dom inspector tab
- select
copy xpathcontext menu - paste selector console
- enclose selector in single quotes
- enclose selector in $x() method of console api
- append array index of selector match
append desired property/method reference
$x('//*[@id="header"]')[0].innertext
Comments
Post a Comment