Skip to content
Advertisement

The best way to bind event on a cell element

I’ve a web page fulfilled by a JS script that creates a lot of HTML tables. Number of <table> created can vary between 1 and 1000 with 100 cells in each of it. My question is : how to bind efficiently the click on theses tables? Should I bind the click on each cell of the <table> or directly to

Fire a function on a element

I need to add a color picker to some input elements. I’m using: This works perfectly. The problem is that the page has a AJAX form, which – when submitted – will overwrite the previous form with a new one (new input fields etc). After that the colorPicker stops working. So how can I fire that function to the newly

Javascript regular expression: remove first and last slash

I have these strings in javascript: and I would like to remove the first and last slash if it’s exists. I tried ^/(.+)/?$ but it doesn’t work. Reading some post in stackoverflow I found that php has trim function and I could use his javascript translation (http://phpjs.org/functions/trim:566) but I would prefer a “simple” regular expression. Answer “Replace all (/…/g) leading

How to write this crawler in JavaScript?

The idea is very simple: Imagine a simple white page with a form with a single input tag (like Google homepage ). When I insert a link of a blog post in this form, then the javascript-crawler search the first image in the web page of the blog post (through ajax), show it in the white page and save it

Dynamic Ad script Replacing Page

I have an application that uses a mobile ad provider; the way ad provider works is that I make a request on the server side, the provider returns me the mark-up and I include that on my site. In order to make the load page faster (which is a requirement that I don’t control), I have an AJAX call to

Advertisement