Running jQuery call in Firebug Console

22,260

Solution 1

Like others have said, it wont work unless you have jquery included on the page. However, you can easily include jQuery on any page with this bookmarklet: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet

Solution 2

Just put this before your code in firebug console:

include("jquery");

more...

Share:
22,260
GregH
Author by

GregH

Updated on January 20, 2020

Comments

  • GregH
    GregH over 4 years

    Sorry, new to Firebug. I really find being able to run javascript in the Firebug console window helpful. However, I don't seem to be able to run jQuery calls in the console. For example, in my executing javascript in my page, I may make the call to get a value:

       jQuery('#an_element_value').text()
    

    However, I cannot execute this in the console. In order to retrieve this value from the page in the console I have to execute:

       document.getElementById('an_element_value').innerHTML
    

    Is there a way to execute jQuery calls and reference page elements through jQuery in the Firebug console?

  • GregH
    GregH over 14 years
    I added this JQuerfier bookmarklet. I don't get any errors but all that outputs on the console is the command I entered. For example, jQuery("#a_current_val").text() results in: >>> jQuery("#a_current_val").text() The content of the textbox does not output.
  • Amiel Martin
    Amiel Martin over 14 years
    weird, I'm used to firebug showing the result. Have you tried console.log(jQuery('#a_current_val').text()) also try just jQuery('#a_current_val') to make sure that you haven't mistyped the id of the element. (it should return an array, empty if no element matches the id)
  • John Smith
    John Smith almost 9 years
    Why did my comment disappear? I said that this was the best answer on the page but it should probably be include("code.jquery.com/jquery-latest.min.js", "jquery")
  • krlzlx
    krlzlx over 8 years
    Yes, worked for me too! After including jquery with Firebug Console, the following message information appeared in console: jquery-latest.js properly included.