addClass every nth

try $(“ul li:nth-child(3n+1)”).addClass(“A”) $(“ul li:nth-child(3n+2)”).addClass(“B”) $(“ul li:nth-child(3n)”).addClass(“C”) Feel free to consolidate it to make it prettier, but I wanted to expose the selectors.

Loading jQuery into chrome-extension

Content scripts will never run in the context of an extension. The correct way to load scripts in your browser action popup is by including it in your code. Let your manifest file be: { “name”: “Test Extension”, “version”: “0.1”, “manifest_version”: 2, “options_page”: “options.html”, “browser_action”: { “default_icon”: “icon.png”, “default_popup”: “popup.html”, “default_title”: “Click me!” } } … Read more

Passing parameters to a page-id in jQuery Mobile

Yes, parameters on the hash are not supported by default. I’ve been using the following plugin to give me that, and it’s been working pretty good so far 😉 UPDATE – HOW TO USE: I’ve added the following code after including $(document).bind(“pagebeforechange”, function( event, data ) { $.mobile.pageData = (data && data.options && … Read more

How do you bind jQuery UI autocomplete using .on()?

If I understood correctly, your problem looks very similar to one I saw in another topic. I’ll adapt my answer to your case, let’s see if it solves your problem: $(document).on(“focus”,[selector],function(e) { if ( !$(this).data(“autocomplete”) ) { // If the autocomplete wasn’t called yet: $(this).autocomplete({ // call it source:[‘abc’,’ade’,’afg’] // passing some parameters }); } … Read more