Hi
I have this code
function calculateTotal() {
var total = 0;
$(".quantity").each(function()
{
if (!isNaN(this.value) && this.value.length != 0)
{
total += parseFloat(this.value);
}
});
$("#total_quantity").val(total);
}
<input onchange="calculateTotal();" name="sol1" type="text" class="result_form_textbox_small quantity" id="sol1" />
<input name="total_quantity" type="text" class="result_form_textbox_small" id="total_quantity" />
This code is working in IE very good but it's not working in FF.
What is the proplem?
Thanks in advance.
Hi, I have a LinkButton click event in asp.net 3.5 that I must assess whether a value exists and return a alert.
I have no idea how you can do. I think we need to Ajax
Can someone help me
Thanks
Hello all,
I am trying to place some html within a td that has an id but this doesn't seem to work. Can JQuery not put html in a td by using its id as a selector??
I do this:
$('#total_match').html("<b>Test</b>");
Here is the td:
<td id="total_match"></td>
No errors occur and nothing appears in the TD - I view the source to confirm.
I appreciate any help.
I have the following kludgey code;
HTML
<input type="search" id="search_box" />
<div id="search_results"></div>
JS
var search_timeout,
search_xhr;
$("#search_box").bind("textchange", function(){
clearTimeout(search_timeout); search_xhr.abort();
search_term = $(this).val();
search_results = $("#search_results");
if(search_term == "") {
if(search_results.is(":visible"))
search_results.stop().hide("blind", 200);
} else {
if(search_results.is(":hidden"))
search_results.stop().show("blind", 200);
}
search_timeout = setTimeout(function () {
search_xhr = $.post("search.php", {
q: search_term
}, function(data){
search_results.html(data);
});
}, 100);
});
(uses the textchange plugin by Zurb)
The problem I had with my original more simple code was that it was horribly unresponsive. Results would appear seconds later, especially when typed slower, or when Backspace was used, etc.
I made all this, and the situation isn't much better. Requests pile up.
My original intention is to use .abort() to cancel out whatever previous request is still running as the textchange event is fired again (as per 446594). This doesn't work, as I get repeated errors like this in console;
Uncaught TypeError: Cannot call method 'abort' of undefined
How can I make .abort() work in my case?
Furthermore, is this approach the best way to fetch 'realtime' search results? Much like Facebook's search bar, which gives results as the user types, and seems to be very quick on its feet.
I set an request attribute in my action class as follows:
request.setAttribute("xFg",Boolean.TRUE);
I want to retrive this in my JSP. I want to retrive them using JSTL tags. I tried this :
<c:if test="${requestScope.xFg}">
<c:set var="showlist" value="true" />
</c:if>
But c:if didnt work, i mean it didnt goto c:set
I tried to print the sameusing c:out but nothing got displayed. What is wrong or How should i test request attribute value. I havent used requestScope so far. Is requestScope the option to get the request value? pls help.Thanks in advance.
Hello,
This are my two functions, on single click it works fine, but on dblclick both functions execute, any idea? I tried using live instead of delegate but still both functions execute on dblclick
// Change Status on click
$(".todoBox").delegate("li", "click", function() {
var id = $(this).attr("id");
$.ajax({
//ajax stuff
});
return false;
});
// Double Click to Delete
$(".todoBox").delegate("li", "dblclick", function(){
var id = $(this).attr("id");
$.ajax({
//ajax stuff
});
return false;
});
I'm developing a website that uses an Ajax plugin to like/dislike/comments an item. But when there are multiple items on the same page, the page takes too long to be displayed. On google chrome for instance, for 10 items you have to wait something like 10 seconds before you can see anything.
But in Firefox, and IE 8, the other elements of the page are displayed, and only the likes/dislikes take some time. But the advantage is that they are displayed as soon as they are loaded. So this is much better.
So how come Google Chrome is less efficient than Firefox and IE? Is there a trick to display on Chrome the page like in Firefox?
I have attached a Firebut image of the loading page.
http://img59.imageshack.us/img59/9475/scriptj.png
Thanks for your help.
I have a form and I can't get my links to generate. The next button is supposed to light up followed by a bit of text.
How it's supposed to work: http://jsfiddle.net/zMQcn/
The one that doesn't work: http://jsfiddle.net/Yq8Qf/
document.getElementById("linkDiv").innerHTML="<input type=button value=Next onclick=\"window.location.href='http://yahoo.com/';\">other 8b white</input>";
}
I am working with openlayers and I can get a point on a map but I can't get the individual coords.
feat = drawLayer.features[0];
var geom = feat.geometry;
var loca = geom.toShortString();
var long = loc.substr(0,9);
alert(geom.toShortString());//returns the correct coords in xx.xxx,xx.xxx format
alert(loca);//returns 2 very large numbers in xx.xxx,xx.xxx format
alert(long);//returns the first, incorrect number
What exaclty am I doing wrong and how can I correct it?
Thanks
/^\d{1,2}[:][0-5][0-9]$/
is what I have. this limits minutes to 00-59. It does not, however, limit hours to between 0 and 12. For similarity and uniformity I would like to do this with RegEx alone if possible.
Further-more I would like the first digit to be optional. i.e. 09:30 accepted as well as 9:30. I played around with ranges, but something out of range is always acceptable.
I've got the following function that manipulates an element according to the data being sent (an object).
function manipulateElem (elem, data) {
for (var key in data) {
elem[key] = data[key];
};
}
manipulateElem(document.getElementById('test'), {'href': '/home/', 'style.color': '#000000'});
As you can imagine, the later (style.color) doesn't work. How would one solve this the best way?
I have a div which has this list of suggestions. But i need to allocate it at the caret position of the textarea. Is this possible if yes, help me to do it.
function findOffsetPosition(obj) {
var posX = obj.clientLeft; var posY = obj.clientTop;
while (obj.offsetParent) {
if (obj == document.getElementsByTagName('body')[0]) { break }
else {
posX = posX + obj.offsetParent.offsetLeft;
posY = posY + obj.offsetParent.offsetTop;
obj = obj.offsetParent;
}
}
var posArray = [posX, posY]
return posArray;
}
I've written a simple script that displays circles over an image.
When you hover over a circle it expands to a tooltip.
$('div.tooltip').live({mouseenter:function(e){
... animate tooltip open;
},mouseleave:function(e){
... animate tooltip closed;
}});
When you click on the open tooltip it displays a lightbox with more information.
$('div.tooltip').live('click',function(e){
... open related lightbox
});
Everything works as it should, except on mobile devices. When I tap the circle to open the tooltip it fires the click event and completely bypasses the mouseenter/mouseexit events.
Any ideas would be greatly appreciated :) Thanks
So basically making some concept logic for a project I am working on. Basically it's a portfolio and each box will be a picture and I want to be able to change the value of a h2 to some type of description. Right now it's just a black box so 'square1, square2, square3...etc' will work for now. I looked up some stuff on jquery and found this link from an SO answer. Basically what I need but he is only shifting through one piece of information instead of many in my case. Wondering how I can achieve that via jquery. I imagine I would need to make an array with all the descriptions I need, and (this is where I am lost) somehow attach the value of array to the square and then from there change text of h2 to the array value. Thanks for any help in advance here's what I have so far (not much just did some foundation work). Not sure if this matters but if there is no hover I want the h2 to say nothing.
HTML (makes me post code if I have jsfiddle)
<div class="squares">
<div class="square1"></div>
<div class="square2"></div>
<div class="square3"></div>
<div class="square4"></div>
<div class="square5"></div>
<h2 class="squareIdent"> </h2>
</div>
how i can get the contentWindow.location of the iframe where the iframe src contain different domain name?
i have googling about this , but i found some thing like proxt,
so how i can get the location of the window inside iframe where iframe src is not on the same domain?
function attachFile(){
document.getElementById("file").click();
return;
}
Attach File
I've written like this and it's working on IE but not working on FireFox
Hi,
I would like to find a function that will return this kind of formatted values :
1.5555 => 1.55
1.5556 => 1.56
1.5554 => 1.55
1.5651 => 1.56
toFixed() and math round return this value :
1.5651.fixedTo(2) => 1.57
This will be usefull for money rounding.
I have a simple html dropdown, I wants to use jQuery if possible to display all the options if this control has the focus(as if the user click on the dropdown). I have tried jQuery trigger(), click(), to avail.
<select id="single">
<option>Single</option>
<option>Single2</option>
</select>
This question already has an answer here:
In jQuery, how to attach events to dynamic html elements?
9 answers
I'm making a simple to do list. It's mostly working and finished. When you click on list elements the object gets removed and you can create new list elements through the text input at the bottom. The only problem is the new list elements can't be removed when you click them for some reason.
Here's the code:
http://jsfiddle.net/dnhynh/7psqndwL/20/
$(document).ready(function(){
$("li").click(function(){
$(this).remove();
});
$("button").click(function(){
var entry = $("#entry").val();
$("<li></li>", {
text: entry
}).appendTo("#list ul");
$("#entry").val("");
});
});