Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to view jQuery added data in Chrome

When creating websites I often use jQuery's .data() function to add data to elements.

Is it possible to view all data which is stored with an element in Chrome?

So when I inspect an element it shows the data in Chrome itself.

If not would it be possible to write a plugin to 'extend' to Chrome element inspector to also show to data?

like image 394
PeeHaa Avatar asked May 09 '11 19:05

PeeHaa


People also ask

How do I see post payload in Chrome?

Note: To actually see a post request that reloads your page, you need to check "Preserve Log". In Chrome 71, the body (ie. POST-ed data) shows up at the bottom of the Headers tab under the "Request Payload" heading.

How do I track JavaScript execution in Chrome?

One simple approach is to start Chrome Developer Tools, switch to the Sources panel and hit F8 (Pause Execution). This will break on the first executed JavaScript statement.

How do I view a variable in Chrome?

You need to double click the variable name, then right click will reveal the add to watch option.


2 Answers

Open the inspector, and into the console, type

$('<some selector>').data() 

and then hit return to evaluate the data() method and show its return value directly.

There's no need to use console.log unless you're calling it within non-interactive code.

like image 116
namuol Avatar answered Oct 07 '22 22:10

namuol


Chrome Query

Can be found in the Chrome Extensions Webstore and adds another tab to the properties panel in the developer tools.

like image 43
tobibeer Avatar answered Oct 07 '22 21:10

tobibeer