Is there any good practice to avoid your jQuery code silently fail?
For example:
$('.this #is:my(complexSelector)').doSomething();
I know that every time this line get executed, the selector is intended to match at least one element, or certain amount of elements. Is there any standard or good way to validate that?
I thought about...
Hi,
I have a document.onclick function that I would like to have a delay. I can't seem to get the syntax right.
my original code is
<script type="text/javascript">
document.onclick=check;
function check(e){do something}
I tried the below, but that code is incorrect, the function did not execute and nothing happened.
<script type...
Is there a way to open two pictures in one frame?
...
I'm using jWYSIWYG in a form I'm creating that posts to a database and was wondering how you can prevent a malicious user from trying to inject code in the frame?
Doesn't the editor need brackets (which I'd normally strip during the post process) in order to display styles?
...
I'm trying to use ExternalInterface.addCallback to allow js to call an as3 method. My code is as follows:
AS:
ExternalInterface.addCallback("sendToActionscript", callFromJavaScript);
function callFromJavaScript():void{
circle_mc.gotoAndStop("finish");
}
JS:
<button type="button" onclick="callToActionscript()">Switch to square</...
Hi all,
I have a question regarding the placement of javascript within facelet components. This is more regarding best practice/style than a programming issue, but I feel like all the solutions I have thought of have been hacks at best. Ok here is my scenario:
I have a facelet template like so (my faces, and apache Trinidad)...
<ui:com...
I'm using jQuery and made a plugin for some in house work that basically builds URLs for our internal API. Anyways, I want to return $(this) and im not getting the right thing and im getting a createdocumentfragment error?
Plugin code:
$.get(base_url,{
agenda_id:defaults.id,
action:defaults.action+defaults.type,
output:defa...
I have a web page that contains a "div" element. On the page, there is javascript to reference the div: document.getElementById('divId'). This was working fine until another developer redesigned the page to use an ASP master page.
Now, document.getElementById('divId') returns null. It appears that ASP.net prepends some characters to ...
I am looking for an algorithm to wrap text within a non-rectangular shape, preferably based on the Knuth and Plass algorithm. The hardest part of this is that the lines may have different heights due to differing font sizes in the text. The image below is an example of what the algorithm should be able to generate.
Thanks for any hel...
With mobile devices or embedded systems you often support only one browser for performance and memory reasons. With traditional JS libraries you must limit yourself in features and performance to support as many browsers as possible.
This is exactly what I would like to avoid.
Are their any JavaScript libraries out there focusing only o...
I've written an ATL/ActiveX object which exposes various properties and methods through its COM interface. I'd like to be able to access those methods and properties from a Silverlight application. The problem I'm running into is that I can access the methods from Silverlight/C#, but I haven't figured out the right syntax for accessing...
I'm working on a multipage form in .Net using AJAX (UpdatePanels). I am stuck right now trying to get a class added to the textbox that is invalid to basically highlight it red.
I found a sample online using this code:
$("span.invalid").bind("DOMAttrModified propertychange", function (e) {
// Exit early if IE because it throws...
I have input checkbox something like this..
<input class="inputchbox" id="Pchk" type="checkbox" name="check" value="<%=Model.ID%>" />
using javascript I need to get the all checkbox checked Ids in to the array?
how do I need to get?
thanks
...
We're rolling out a redesign of helpcurenow.org, and we've implemented a Twitter feed in the footer. (I'm the design & front end guy, my coworker is the scripting & backend guy).
All is well with the Twitter feed in all major browsers except internet explorer, version 8 and later.
However we have no clue why IE is not pulling the feed...
I have an Array in PHP which contains data from database. And it prints out also as a table in the same page which has an AJAX delete function.
Trying to explain better
The array contains debt sums related to many people, it is the application's main function. In the same page, there is a table containing every debt record related to ...
I'm trying to split up a nucleotide sequence into amino acid strings using a regular expression. I have to start a new string at each occurrence of the string "ATG", but I don't want to actually stop the first match at the "ATG". Valid input is any ordering of a string of As, Cs, Gs, and Ts.
For example, given the input string: ATGAAC...
"X" is reading the form value, but it is still passing and older "var thisMarket" value.
The objective is to take a zip code via HTML form:
<form id="market" name="market" onSubmit="return validateZIP(this.zip.value);" method="get" action="">
<input type="text" name="zip" id="zip" value="zipcode" onfocus="if(!this._haschanged){this.v...
What is the best way to gray out text inputs on an HTML form? I need the inputs to be grayed out when a user checks a check box. Do I have to use JavaScript for this (not very familiar with JavaScript) or can I use PHP (which I am more familiar with)?
EDIT:
After some reading I have got a little bit of code, but it is giving me probl...
is there a function that would add a time delay between 2 lines of code. Not the settimeout, because settimeout requires a function/object in its arguments.
I am looking for something like this pseudo code
write "abc";
delay(500);
write "xyz";
TIA
Edit:
jimr's solution in my other thread worked for my purpose, and so is Robusto's....
I have read most of the posts on here regarding floating point, and I understand the basic underlying issue that using IEEE 754 (and just by the nature of storing numbers in binary) certain fractions cannot be represented. I am trying to figure out the following: If both Python and JavaScript use the IEEE 754 standard, why is it that exe...