Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view jquery data() using Firefox/Firebug or other browser

I usually use firebug to troubleshoot JavaScript.

Other than inserting script like I did below, is there an easy way to view jQuery data() associated with an element using Firefox/Firebug? I am open to other tools such as Chrome if necessary.

<div id='foo' data-bar='hello'></div>
...
$('#foo').data('bar','goodby');
...
console.log($('#foo').data('bar'));
like image 892
user1032531 Avatar asked May 09 '26 23:05

user1032531


1 Answers

You can enter JavaScript into most debugging consoles; if you type in your code and press enter you will see it's output beneath, like so:

Google Chrome JavaScript Console

The above example is from Chrome.

like image 117
edcs Avatar answered May 12 '26 14:05

edcs