I've completed writing a purpose-specific plugin and there are a few spots where I have duplicate code and due to the structure of the function, I'm not quite sure how to cleanly get rid of repetitious code.
You can see the code here:
http://jsbin.com/aboca3/8/edit
I am specifically referring to the 4 switch statements and wondering h...
Hi!
$("*").click(function(){
$(this); // how can i get selector from $(this) ?
});
Is there easy way to get selector from $(this) or something like that? There is a way, how to select element by selector, but how about getting selector from element?
Thanx for any help =)
...
I've got some code to work with dates in javascript.
This works in IE, FF, Safari (desktop versions win & mac), Chrome, Opera.
In iPhone safari (mobile safari), i get a 'invalid date' response.
The code for managing dates is
function fixDateFormat(dateText){
var isoExp = /^\s*(\d{4})-(\d\d)-(\d\d)\s*$/,
newDate = new...
I am a web developer for a Django-based site for a student organization, and I have the opportunity to make the website temporarily absurd for a day of general campus-wide debauchery and chaos (long story, doesn't matter.)
What are your best ideas for web development practical jokes (that you could never use in the real world)?
For exa...
http://lalalafactory.blogspot.com/2008/02/light-alet-lightalertjs.html
Can anyone tell me what to change that JS confirm button will also work. I add
function confirm(obj){
new LightAlert(obj);
}
but still works like alert not confirm.
...
The HTML5 spec defines some very interesting validation components, including pattern (for validating against a Regexp) and required (for marking a field as required). As best I can tell, however, no browser yet actually does any validation based on these attributes.
I found a comparison of HTML5 support across engines, but there is no ...
I would like to disable the same origin policy on XMLHttpRequests in my own embedded WebViews. I have control over the pages loaded / code being executed in the WebView, so I do not care about enforcing the same origin policy. I would like to make cross-domain requests.
I've tried implementing the WebPolicyDelegate and WebResourceLoadDe...
I have coded a Javascript bbcode similar to the one I'm using to write this message. It also incorporates a live preview box like the one I see below. The only problem I'm facing at the moment is that some nested bbcode is not parsing.
For example:
[quote]
[quote][/quote]
[/quote]
Is not parsing correctly.
This is my Javascript c...
so I have an external javascript file, lets call it something.js and i document.write it to the document. For some reason, I cant access the function in Safari or FireFox.
It goes a little something like this:
<script type="text/javascript">
document.write(decodeURI("%3Cscript src='something.js' type='text/javascript'%3E%3C/scrip...
I have a drop down list, if someone selects an option I want to redirect to another page based on the selection.
How can I do this via jquery?
...
Hello,
I'm trying to make a Javascript function that will take a math equation and do it on a predefined number for example:
var myNum = 10;
function EQ(eq){
// code here
}
For example the input should me something like this:
EQ("*100/10"); //output 100
EQ("+100"); //output will be 200
EQ("-+=1"); //output false
Is there an...
What wrong with the my code. When I click on the checkbox, nothing happen
$(document).ready(function(){
$('input:checkbox[name=drawingNo]').click(function(){alert('I am here');});
});
...
<body>
<form>
<input type="checkbox" name="drawingNo" value="1"> 1 <br>
<input type="checkbox" name="drawingNo"...
I am designing a creation wizard in ASP.NET MVC 1 and instead of posting back each step, I'm using javascript to toggle the display of the different steps divs.
This is a quick sample of the code, just to explain.
<% using (Html.BeginForm())
{%>
<fieldset>
<legend>Fields</legend>
<div id="wizardStep1">
<% Html.RenderPartial("Cre...
Hi Guys, I am a Javascript Junkie and wishing to test around some codes.
new RegExp("user=" + un + "[\"'\\s>]", "i")
what will this actually mean?
It was from a site, and it actually works!
I especially don't get the [\"'\\s>] part.
...
I doubt this is possible, and I'm certain to do it in a production environment would be an impressively bad idea. This is just one of those hypothetical "I-wonder-if-I-could..." things.
I was wondering if it is possible to modify or extend how the browser JavaScript engine parses the code at run-time. For example: if I tried to use...
Hello
i'm trying to find a way to match this problem but i'm LOST
i want it to match a math equation that will accept string if:
"+-*/%" at anywhere in the string but not in the last character of the input string
it accepts float and integers
it doesn't accepts letters just numbers and signs
any help ?
Thanks in advance !!
...
I want the html are fully loaded then execute the inline javascript because this script stops the load of the html document.
To try to solve this problem I put the inline javascript code at the end inside a div then i use the jquery .append method
$("#subhimedia").appendTo("#himedia");
This works and appends the inline js that i...
I have a php loop that is echoing out geolocation values. How can I get it to write those values to a javascript array, so I can then use them to plot points on an HTML5 canvas?
The php loop is as follows
<ul id = "geo-list">
<?php foreach($data as $phrase) { ?>
<li><?php
if ($phrase->geo != false) {
...
Here is my chunk of code:
var update_shipping_methods = function(methods) {
$(methods).each( function(i) {
$('div$methods img#shipping_loader').remove();
var p = document.createElement('p');
var s = this.name + ' ' + this.rate;
var i = $(document.createElement('input'))
.attr('id', this.id)
.attr('type', 'r...
i have posted a previous question about Regular Expressions and this is another question it's not duplicate ... sorry for that
Hello
I really need some help in Regular Expressions, i'm working on a function like
var x = 0;
function doMath(myVar){
RE = //; // here is the problem
if(RE.test(myVar))
eval(x+myVar)
else
return fals...