how to convert -1 to 1 with javascript ?
var count = -1; //or any other number -2 -3 -4 -5 ...
or
var count = 1; //or any other number 2 3 4 5 ...
result should be
var count = 1; //or any other number 2 3 4 5 ...
...
Hello,
Weird problem here, I'm trying to use a global function to update my settings object, example:
var Settings = new Object;
Settings.savepos = 'true';
function UpdateSetting(obj,value){
eval("Settings.obj = value");
alert(Settings.savepos);
}
The obj is the key of the object, meaning if I call th...
I have built a fairly complex form which includes a hidden section that the user can toggle open for entering more information if necessary. However, when you click on this toggle button labeled I have more Nativities, it triggers the submit button and prematurely submits the form.
The form is in dev right now, but it can be found here....
I was experiencing some weird behaviour in some of my javascript code, but only in Firefox and Chrome. IE is fine.
I have isolated the problem and created a little page so you can see the behaviour yourself.
Essentially, it appears as if the Regular Expression object in MethodC is being reused across method calls to MethodC, even thoug...
This is my first question, i'll try to be as clear as possible.
I'm building a personal site using different APIs hosted on google code:
Google Search ---> user search for random info
Google Map ---> will be used to locate the user
Jquery -----> simple javascript interaction
Jquery UI ----> using the tabs module for the page's main m...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11//DTD/xhtml11.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Dom demo</title>
<script type="text/javascript">
function changeText()
{
document.getElementById('first').innerHTML="Second Entry";
document.getElementById('second').inner...
I understand that the title is a little vague and all-encompassing, so please let me try to narrow it down.
What I would like is advice on how to develop a mostly Ajax website, where portions of the UI are asynchronously loaded. Here's the catch: I'd like to have the browser back/forward buttons work intuitively - something that Faceboo...
When I try to read a file synchronously, Firefox freezes.
When I try to read a file asynchronously, I get numbers instead of words.
This code snippet...
var MY_ID = "[email protected]";
var em = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
var file = em.getInstall...
To see the issue go to this page and click the next text. The small, medium fullsize text will be off to the left (in IE8 or IE9, works fine in Chrome, FireFox) and will not be aligned with the left edge of the image.
Code (http://moments.qa.chucksoft.com/Scripts/mvc/views/show/Showview.js) Line 154:
ShowView.prototype.setImageSrc...
Possible Duplicate:
javascript ? : notation
what does the "?" operator mean?
...
Telerik radlistbox fires both OnClientItemChecked and OnClientSelectedIndexChanged when an item is checked in Firefox and IE but not in Chrome.
Chrome seems to have the proper behavior. Is there a reason for this?
Can I make IE and Firefox behave accordingly as well?
Some more context;
This radlistbox gets loaded in an ascx panel.
...
I have an AJAX call using jQuery:
$('.add a').click(function() {
$.ajax({
type: 'POST',
url: '/ajax/fos',
context: this,
datatype: 'html',
success: function(data){
$(this).parents('tr').before(data);
}
});
});
Once it runs, it adds a new row to a table. The row is ver...
bind multiple events, then unbind a couple of them? is this right?
basically when you hover over the element, the background color changes, then changes back when you hover out of the element, but when you click the element i want to disable the hover effect and change the background color to a different color so the user knows that the...
I want to create the following DOM structure using jQuery.
<li>
<label> user
<input type=radio>
</label>
</li>
Here is my jQuery.
$('<input>')
.attr({type:'radio'})
.appendTo($('<label>'))
.text('user')
.appendTo($('<li>'))
Some how it's not working or there is something wrong, what would be best practice here?
...
Is there any way (aside from creating a new event) that I can tell when a particular CSS class has been added to an element?
...
Hi All,
I have posted a sample jQuery slideshow on my blog here:
robertmarkbramprogrammer.blogspot.com/2010/09/jquery-slideshow.html
In Chrome, it is flickering on each picture. In IE and Firefox it looks fine, and in the standalone version it seems ok too (even on Chrome):
http://robertmarkbram.appspot.com/content/javascript/jQuery/ex...
For example, I have a super simple widget that I want to allow my users to use across sites:
<h1>Headline</h1>
#mingyeow is the name of the user
<% render "/questions/mingyeow" %>
What would be the easiest way to do?
exact method to allow this
javascript vs iframe
cross site security concerns
...
I like jQuery's ability to method chain commands ( .animate().css() etc ) which in the backend is achieved by returning the special variable "this".
How can I implement a similar method of chaining without having to set state within my object. Take for example:
that.getHospitalCoverDataStore().findBy('short_name').withValue('sam');
T...
In one section of code I have this:
$("#searchbar").trigger("onOptionsApplied");
In another section of code, I have this:
$("#searchbar").bind("onOptionsApplied", function () {
alert("fdafds");
});
The bind() is executed before the trigger(), but when I view the page, I never get an alert().
Why not? What am I doing wrong with...
I am building a block of nested divs around a specific element on the client. I am using jQuery's .wrap() initially to get the first part of the block which is working fine. But now I want to attach the ending block after the element I am wrapping and I am finding I can't attach it to anything because it is all being created at the same ...