I'm trying to create an if...else if...else statement in Javascript that will change the style of a specific CSS ID based on a specific number. The if...else if...else code isn't the problem, it's just that as a Javascript novice (putting it lightly...) I'm not sure where to add the CSS code to execute it. From what I understand I would ...
so is something like this possible?
Y.one("input.units").on("keyup change", function(e){
...
});
the jquery equivalent is
$("input.units").bind("keyup change", function(e){
...
});
...
I am using ajax to load my website content and want to update the window location when ajax is successful.
How can I update the window location to "/newpage"?? I need users to be able to go back and to refresh. Is this possible??
...
Here's a simple javascript program:
var $d = {};
var AudioPlayer = function(filename, timeUpdateCallback, playbackDone){
// An HTML5 audio player is defined here.
}
$d.AudioPlayer = AudioPlayer;
var AudioManager = function(chapterId){
var audioPlayer;
var me=this;
this.next = function(){
...
...
As jQuery devs know, jQuery allows easy dynamic HTML creation like this
var d = $('<div/>')
.append('some text')
.append(
$('<ul/>').append(
$('<li/>').text('list item')
.css("color", "blue")
.click(function() {
// do something
...
Often I add helper functions to my PHP that return complex HTML. For example, it is not an easy task to ensure that a form element is accessible, can handle errors etc. and so I will have a PHP function wrap this problem.
Unfortunately, sometimes, I will need to generate the same HTML but with JS instead. An example of this is where I h...
I have a function which I need to appear within a jQuery $(document).ready(function() {} - I am au fait with javascript but not really worked with jQuery. How can I jQuerify this function?
function populateContext()
{
contextTxtBox = document.getElementById('searchContext');
pathArr = window.location.pathname.split( '/' );
...
How come Object.prototype.toString === toString? If I have this in the global scope:
var toStringValue = toString.call("foobaz");
I would expect toStringValue to be the value of window.toString because window is the default scope, right? How come toString by itself resolves to Object.prototype.toString instead of window.toString?
...
I've read on websites and heard on podcasts that the Google doodle is was bestowed upon the masses through the miracle of HTML5. I looking at the code and validated the source of the Google homepage page via W3C and received 35 errors. While HTML5 is certainly fine and dandy it seems the real work is being done by CSS3 and JavaScript. ...
I need format html string. Just like in some html editor (Netbean with Alt-Shift-F). Anyone know any js function or lib can do this?
...
Within my body tag, I have this:
<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAkh87y8Hjhg76ty" type="text/javascript"></script>
Is it possible to add Javascript or jQuery in the head of the page to change the "key" parameter in the script source. I am trying to do this before the render reaches the ...
I am trying to create a form for my company's website. I am letting a customer selectively donate to my company upon download of a piece of software. If they check a box, I'd like a "Donate" button to appear with code to go to my third party store (I know how to do this), and if they don't select the checkbox, then I'd like a different b...
not sure what i am doing wrong below. any pointer is greatly apprecited.
i am being returned "-1". Not sure if i am creating incorrectly (cookies exist and are listed at 161 or so), but not sure if mine is in this group.
<html>
<body>
<div id="cookieLaunch" onClick="cM()">abcdef</div>
<script>
function cM(){
var cookie_date = new Dat...
Hi all,
Here's the problem, in abstract terms: i have three input fields (A, B, C). two of them need to be text inputs (A and B), the third is of irrelevant type. I need to enable the third if A is not empty and B is not empty. I need to disable C if A is empty or B is empty.
The code
// empty is the empty function from the phpjs pro...
I have the following snippet of code:
$('input#teamName').live('blur', function() {
var value = $(this).val();
if (value) {
$.getJSON('api/event_company/'+value, function(data) {
console.log('why does this not want to work?');
});
}
});
Basically all it's doing is requesting some data from the server when a form fi...
Hi,
Why I want to block a JS file download in HTML? Well, this is my time-chart for the page load:
jQuery (1.2) loaded
jQuery plugin loaded (extends the current jQuery object)
custom JS loaded
custom JS uses document.write to add extra scripts
the added extra script loads a new jQuery (1.4, but it doesn't matter)
-> so my extension is...
I am making a mobile webapp for iPhone and probably other devices and am able to get the lat/long with a reasonable accuracy but I'm not getting any other values from the phone's GPS. The 'heading' is quite important for what I'm wanting to do. Is there a way for Mobile Safari to give this info or is it not supported yet? I haven't found...
I have this very usefull little piece of javascript that centers mig div. By i would like to make it apply to 3 divs on the same site, without repeating the same piece of code 3 times.
Any ideas on how to do it?
Putting all 3 divs into 1 divs that takes care of it, is not and option.
<script type="text/javascript">
<!--
functi...
I am creating a 'FAQ' page which has a list of questions at the top (links) and the answers appear below.
As each question is clicked the corresponding answer is shown (using show/hide divs). My questions is, is there a way to make the clicked question/link bold and for it to stay bold until another question is clicked, in which case t...
Hi,
After using jQuery for a long time now I have a question, I'm writing a simple code using the jQuery pattern(style),
(function(window, undefined) {
var jQuery = function (s, c) { ... }
}) (window);
As we all know jQuery is defined in a self Executing anonymous function, I guess its scope (jQuery) should be restricted to tha...