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.
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.
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
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 😉 jqm.page.params UPDATE – HOW TO USE: I’ve added the following code after including jqm.page.params.js: $(document).bind(“pagebeforechange”, function( event, data ) { $.mobile.pageData = (data && data.options && … Read more
$(‘[id]’) returns all elements that have id set
With two states, you can just maintain the current toggled state as a boolean (I used clickState). If you wanted to have multiple states, you could continue to add 1 to the state count and then check the modulus of the total count to determine which function should fire based on the state. I updated … Read more
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
The unwrap method will work fine (you can select any of/any number of the siblings): $(“#innerDiv1”).unwrap(); From the docs (emphasis added): The matched elements (and their siblings, if any) replace their parents within the DOM structure.
There are custom events for the collapsible blocks. You can bind to the expand and collapse events: $(‘#my-collapsible’).bind(‘expand’, function () { alert(‘Expanded’); }).bind(‘collapse’, function () { alert(‘Collapsed’); }); Here is a jsfiddle: http://jsfiddle.net/6txWy/
just change the trigger ‘change’ to ‘selectmenuchange’ $(‘#filesA’).on(‘selectmenuchange’, function() { alert( ‘x’); });
If you want to upload twice, clear file input value $(‘input[type=”file”]’).val(null); jsfiddle test