- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 300
- Posts with Upvotes
- 268
- Upvoting Members
- 177
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 3
Largely sane.
- Interests
- Vintage steel bicycles, Art Deco ceramics, Achimenes, WWII history, Suzuki Cappuccinos, Hurtigrute.
- PC Specs
- Various. Nothing special. Mostly last Millennium sub-GHz, except my little netbook - new in 2011.
1,330 Posted Topics
Re: Pretty simple, start with array [1, 2, 3] (representing offsets from current month) and map it to the array you want. function getNext3Months() { const currentMonth = (new Date()).getMonth() + 1; // getMonth() is zero-indexed; add 1 to give conventional month number. return [1, 2, 3].map(n => (currentMonth + n) … | |
Re: Solid, I've been following this but with nothing to offer. Now I know the solution, I understand the problem! My twopenny worth (after the hard work is done) .... it would be slightly(?) more economical to make $(this) just once inside the each loop: [CODE] $('.task-title').each(function() { var $this = … | |
Re: The days of generating a special page for print purposes are long gone. Instead of composing HTML on the fly, try mastering CSS @media rules : * https://www.w3.org/TR/WD-css2/media.html If there's going to be any dynamically generated content, you will still need some javascript; but more typically @media rules alone allow … | |
Re: I posted a link to a fiddle back in the [original post](https://www.daniweb.com/programming/web-development/threads/506905/printing-values-of-jquery-custom-autocomplete#post2213571) | |
Re: As it stands, the question is not 100% self-explanatory, in particular the relationships and juxtapositions of the various input elements. Maybe it would be clearer if you posted an (annotated) screenshot of the original spreadsheet and/or the HTML version. | |
Re: You are expecting javascript arrays to behave like PHP arrays. They don't! Elements of a JS array are indexed exclusively by integer. Confusingly, JS arrays can also be given properties, so `tmp[14]['G'] = foo` is quite legal but not what you might expect from knowledge of PHP. `['G']` is a … | |
Re: The formula will simplify enormously. ((lcost1*24-(dp1/2))/24)+((epay1-(dp1/2))/24) can be written : lcost1 + (epay1 - dp1) / 24 And you probably want to display : (lcost1 + (epay1 - dp1) / 24).toFixed(2) ie rounded to 2 decimal places. | |
Re: Why is this tagged "jQuery" when everything is written in POJS? | |
Re: Dan, I don't know which countdown plugin that is but [URL="http://keith-wood.name/countdownRef.html"]this one[/URL] by Keith Wood has a [iCODE]serverSync[/iCODE] capability and is very well documented. [B]Airshow[/B] | |
Re: Gagan22, A very similar question was answered just a few days ago. Sugest you read the thread and see if it provides an answer: [url]http://www.daniweb.com/forums/thread139039.html[/url] [B]Airshow[/B] | |
Re: Pranab, There is no JavaScript command that activates JavaScript in a browser. Two reasons: [LIST=1][*]If JavaScript is disabled then the JavaScript engine is not running, so no JavaScript commands can be interpreted. [*]If there was a mechanism by which a web page could force JavaScript to be enabled, then this … | |
Re: The double test for `hasChildNodes()`, at parent and child levels, looks a bit odd. I would have thought you want the parse out the nodes that *don't* have children, in which case your loop will be as follows: for (i=0; i<x.length; i++) { if (!x[i].hasChildNodes()) { alert(x[i].nodeName + '=' + … | |
Re: Double_cola, Broj1 is really trying to help you. Do what he says and ANSWER HIS QUESTIONS. Restating the problem and reposting large sections of code is not going to get you to a solution any faster. | |
Re: Surely `cc` can be permanently appended to `.news-grid` and `cd` can be permanently appended to `cc` with `.show()` and `.hide()` controlling visibility? There doesn't appear to be any need to detach/reappend. Even better, `cc`/`cd` could be hard coded in HTML. I'm not sure this will fix anything but should better … | |
Re: Text questions will most likely attract text answers. If you want code, then provide code. | |
Re: Try [jQuery-turtle](https://github.com/PencilCode/jquery-turtle/blob/master/README.md), "a jQuery plugin for turtle graphics". I've not used this plugin but assume that its "accurate collision-testing of turtles with arbitrary convex hulls" can be used for collision detection of turtles with each other, ie. turtlize each of your eggs. You would need to more-or-less restart your coding … | |
Re: signed or unsigned tinyint? | |
Re: "Another PHP programmer" could be interpreted many different ways. | |
Re: Refresh very deliberately reloads the current document in its original state. The only (and very limited) control the user has (in most browsers) is to do a "soft" or "hard" refresh; - Soft: accepts data from cache(s) - Hard: ignores cache(s) and goes back to the original source (sever). Relies … | |
Re: You want something more like : $(".bot").on('mouseenter', function() { $(this).siblings(".over").fadeIn(1000); }).on('mouseleave', function() { $(this).siblings(".over").fadeOut(800); }); This should give the desired behaviour for all .bots that are in place on page load. If .bots (and/or their contents) are dynamically added, then you need to consider delegation, which would be a mild … | |
Re: As I understand it, the NetFront browser's javascript is not fully featured (and has limited HTML5 support). I would guess that, if jQuery loads without error, some aspects of it will work and some won't. If you try, then please post your findings here. | |
Re: I'm not too sure what the question is but here are a few observations from a client-side perspective : 1. Don't use `async:false`!!! AJAX is fundamentally asynchronous and `async:false` should never have been provided. It is, at best, unreliable. 2. You can't rely on an arbitrary cart-entry index to identify … | |
| |
Re: To give the animation every chance of being smooth, make sure there's no **document reflow**. ie. make sure the div animates into a reserved space. eg. wrap `#block` in another div with width and height set to accommodate the div at its maximum size. Also, **chain the jQuery**, so `#block` … | |
Re: > If you're only seeing the code on the site and in the view source then your hosting doesn't have PHP enabled. Or, the source file is otherwise not served via the PHP parer, eg. it does not have a `.php` extension, or the server is set up to recognise … | |
Re: Two things strike me immediately : Click handlers --- Take a look at the following : $(".conjugate").click(function() { conjugate(); }); and $(document).on("click", ".conjugate", function() { conjugate(); }); This means that any ".conjugate" element that is present in the document at page load will fire `conjugate()` *twice* when clicked!!! jQuery selectors … | |
Re: Siberian, read the first line of my signature. | |
Re: As far as I know, you have to inspect the contents of the files and work out whether they do server-side or client-side stuff. I expect that in some cases, the distinction will be manifest, in others less so. | |
Re: It's difficult to answer questions like this when the HTML is in the form of server-side source code (PHP presumably). Please post the served HTML! | |
Re: So how does the mystical `CHtml::activeTextField(...)` render in HTML? | |
Re: There are no doubt all sorts of HTML/CSS issues that the Owl Carousel author has resolved, so take maximum advantage of that expertise. Instead of emulating the appearance of your Owl Carousel, you might consider (in order of preference) : - a second Owl Carousel, with appropriate options to give … | |
Re: What you show in the question would appear to be the returned JSON, decoded then re-encoded (re-stringified). It woud be more useful to see the raw JSON, which may or may not be the same as the re-encoded JSON. To do this, temporarily use `dataType:'text'`, and `alert (data_)`. | |
Re: The problem is that `count = $(".count")` selects *all* the elements with `class="count"`, not just the one you are interested in whenever a plus/minus button is clicked. You need for the click handler to sniff out the particular `.count` element that is a sibling of the particular plus/minus button that … | |
Re: Or, simplest of all : if( typeof document.frmEntry.optMethod ) { ... } | |
Re: If AleMonteiro's answer works, then so should this simplification of it : var checkboxList = $("fieldset.step input:checked").map(function() { return { 'step': $(this).closest("fieldset").index(), 'checkboxId': this.id }; }).get(); | |
Re: This is actually quite simple if approached the right way. First, let's define the problem in more standard terms : 1. take a collection of `n` congruant arrays each containing `m` elements 2. transform the collection to an array of `m` arrays each containing `n` elements (effectively a matrix row-column … | |
Re: According to the API, the 7th parameter for [ICODE]swfObject.embedSWF()[/ICODE] should be flashvars, not a boolean. Deleting [ICODE]false, [/ICODE] will give it a fighting chance. [B]Airshow[/B] | |
Re: Boots, In this block of code from fastupdate(), it appears that you copied and pasted three lines of code and forgot to edit the left hand side of the statements. [CODE] ... var ba = document.getElementById("ba").value; var bs = document.getElementById("bs").value; var bc = document.getElementById("bc").value; var ba = document.getElementById("sa").value; var bs … | |
Re: Eshko, Do you really mean AJAX? Form submission is a feature of bog-standard HTML/HTTP and can be triggered either by the user clicking the form's submit button or from javascript, eg, [ICODE]forms[0].submit()[/ICODE], which is safe as long as you have just one form on the page. This approach will send … | |
Re: Printing from a new window is a crazy way to achieve something that is catered for by CSS (from CSS2 if I recall correctly). Simply specify an @media rule in your CSS style sheet: [CODE] <style> /* All common (screen) styles here, in the normal way. */ @media print { … | |
Re: Why revive a bonkers 3-year old topic full of wallpaper with more of the same? I'm outa here. | |
Re: Ask yourself, why should it work? How many `<a>` elements are there when `$("a").click(...)` is executed? | |
Re: One-part emails are pretty simple. To be really useful, this function would simplify the composition of multi-part emails such that you could compose two or more parts (eg plain text and markup) and the function would do the formatting into multi-part. Another feature would be a mechanism to send drafts … | |
Re: To concatenate the individual strings together, comma separated : var list_ = list.join(); Then you can do what you want with `list_`. alert(list_); document.getElementById('myDiv').innerHTML(list_);//pojs $("#myDiv").html(list_);//jQuery Only use `document.write` in the document writing phase. Once the document has achieved its `ready` state, `document.write` will blitz it completely. ![]() | |
Re: I would have more confidence in traditional `location.hostname` than `document.domain`, which I've not encountered before. In plain javascript : document.getElementById('myLogo').src = (location.hostname=='domain1') ? 'image1.gif' : (location.hostname=='domain2') ? 'image2' : 'default.gif'; or in jQuery : $('#myLogo').attr('src', (location.hostname=='domain1') ? 'image1.gif' : (location.hostname=='domain2') ? 'image2' : 'default.gif'); or the equivalent `if ... else … | |
Re: Violet, you have discovered the problem but you don't need to refactor your original code to quite that extent : Try : $(document).ready(function(){ form.init(); }); var form = { //object literal init: function(){ $("button").click(function(){ console.log("inside the click " + $(this)); }); } }; or, avoiding the global namespace : $(document).ready(function(){ … | |
Re: Are you saying the code doesn't work, or that it works but you don't understand why? | |
Re: Hi Mossa, Your code is clearly not a million miles away from doing what you want. I think it would benefit from : * Rearranging to do more inside the switch/case structure * Having `$loopCount` as a simple incremental * Judicious use of the `%` operator to work out whether … | |
Re: This may be possible. What have you tried? Please demonstrate some effort! | |
Re: With multiple rows in the table, you must use classes, not ids to identify the various DOM elements. Ids must be unique within a given DOM. With the ids converted to classes, `calculatePtotal()` will be something like this : function calculatePtotal() { $("tr", "#myTable").each(function(i, row) { $row = $(row); var … |
The End.