问题
On Visualforce pages, commands run in the Firebug console command line don't seem to work. For example $(".myClass").show();
returns TypeError: $(".moreInfo") is null
.
I think this is because the Visualforce is all inside an iframe, so my jQuery is included inside the iframe and all the elements I'm trying to select are also inside this iframe. I'm looking for a workaround if anyone knows of one.
回答1:
If the user viewing the Visualforce page is in development mode, the Visualforce page will be displayed in an IFRAME.
So try disabling "development mode" on your user's User Detail Page.
Søren
回答2:
I've always found when using jQuery with VisualForce that it's best to use jQuery.noConflict()
when the page loads and then reference it via jQuery()
as opposed to $()
thereafter.
I've just tried using both $(xx)
and jQuery(xx)
in the console — the former shows the same error you're seeing, the latter works correctly.
Matt
来源:https://stackoverflow.com/questions/7357557/in-visualforce-pages-is-it-possible-to-use-the-command-line-in-the-firebug-cons