jQuery select list removes all options
this would do: $(‘#selectId’).html(”);
this would do: $(‘#selectId’).html(”);
Firebug is great, but Safari provides its own built-in development tools. If you haven’t already tried Safari’s development kit, go to Safari–>Preferences–>Advanced, and check the box next to “Show Develop menu in menu bar”. Once you have the Develop menu enabled, you can use the Web Inspector to get a lot of the same functionality … Read more
So basically, as @BrockAdams identified, there are a couple of solutions to these types of problem depending on the requirements, and they follow either 1 of 2 methods. the browser API switcharoo. The proxy based interception befiddlement. the browser API switcharoo. Both firefox and chrome support browser extensions that can take advantage of platform specific … Read more
If the line numbers aren’t green, it seems like Firebug cannot debug that part of code because it is out of scope. So, if you’re using something like $(function () { … }); Firebug will not be able to access Functions and variables. Does that make sense? Also, is it possible that some other function … Read more
var script = document.createElement(“script”); script.src = “http://whatever.com/js/my/script.js”; document.body.appendChild(script);
There is now a plugin that intercepts JavaScript downloads and deminifies it at that point. Unfortunately, the way it hooks into Firefox means that it applies to all JavaScript downloads and just not specific ones and the JavaScript files have to be served with an appropriate MIME type. https://addons.mozilla.org/en-US/firefox/addon/247565/
Say we have module /app/scripts/methodsModule.js that returns a few methods: define({ someMethod: function() { // do stuff }, anotherMethod: function() { // do some more stuff } }); In our data-main file /app/scripts/main.js we have: require([‘methodsModule’], function(methods) { methods.someMethod() // call someMethod methods.anotherMethod() // call anotherMethod }) Once requireJS loads up our data-main, we can … Read more
You are not calling a function like that, you just define the function. The correct approach is to define the function outside document.ready and call it inside: // We define the function function validate(){ console.log(‘validated!’); } $(document).ready(function(){ // we call the function validate(); }); Another option is to self invoke the function like that: $(document).ready(function(){ … Read more
As I mentioned in another answer, this happens because the Firefox internal APIs, which Firebug uses to output the data, have changed. When you open the Browser Console, you’ll see the following error: TypeError: ConsoleAPIListener is not a constructor console.js:149:38 Note that, as stated in a thread in the Firebug discussion group and on the … Read more
To get the first attached handler on the first $(“#button1”) element $._data($(“#button1″).get(0),”events”).click[0].handler JSFiddle The long story that nobody wants to hear: I came here searching for a plugin. I was thrilled to see @schmidlop’s answer, but in jQuery that doesn’t actually give me the listener I’m looking for, it just shows the generic handler for … Read more