Skip to content
Advertisement

Tag: javascript

Lightweight web browser for testing

I have e very specific test setup in mind. I would like to start a web-browser that understands Javascript and can use HTTP proxy, point it to a URL (ideally by specifying it in the command line along with the proxy config), wait for the page to load while listening (in the proxy) requests are generated as web-page is rendered

jQuery find not working

This is my HTML: And javascript: Doesn’t seem to do anything (read_more is set to display: none) any ideas? Answer Try this: $(document).ready(function(){ $(‘a.more’).click(function(){ $(this).parent().next().find(‘.read_more’).slideDown(); return false; }); }); Update: Here is the demo 🙂 Code: You could also do: Or this:

Get all Javascript Variables?

Is there a way for javascript to detect all assigned variables? For example, if one js file creates a bunch of vars (globally scoped), can a subsequent file get all the vars without knowing what they’re named and which might exist? Thanks in advance 🙂 EDIT, Question Part 2: How do I get the values of these variables? Here is

Embed javascript in markdown

I’m using the Maruku markdown processor. I’d like this but it complains when I render it with a multitude of errors. The first one being and then the rest seems like the parser is going nuts. Then it renders the javascript into a div on the page. I’ve tried making it a CDATA block and extra spacing between the jquery

Does JavaScript have classes?

A friend and I had an argument last week. He stated there were no such things as classes in JavaScript. I said there was as you can say var object = new Object() He says “as there is no word class used. It’s not a class.” Who is right? Edit: July 2017 JavaScript classes introduced in ECMAScript 2015 are primarily

JavaScript setInterval and `this` solution

I need to access this from my setInterval handler How can I access this.prefs in ajax.onload? Answer The setInterval line should look like this:- Edit: The same principle applies to the ” onload “. In this case its common for the “outer” code to do little, it just sets up the request an then sends it. In this case the

How to filter object array based on attributes?

I have the following JavaScript array of real estate home objects: What I would like to do is be able to perform a filter on the object to return a subset of “home” objects. For example, I want to be able to filter based on: price, sqft, num_of_beds, and num_of_baths. How can I perform something in JavaScript like the pseudo-code

Generate syntax tree for simple math operations

I am trying to generate a syntax tree, for a given string with simple math operators (+, -, *, /, and parenthesis). Given the string “1 + 2 * 3”: It should return an array like this: I made a function to transform “1 + 2 * 3″ in [1,”+”,2,”*”,3]. The problem is: I have no idea to give priority

Advertisement