Hi I would like to do dom selection and manipulation out of the dom.
The goal is to build my widget out of the dom and to insert it in the dom only once it is ready.
My issue is that getElementById is not supported on a document fragment. I also tried createElement and cloneNode, but it does not work either.
I am trying to do that in ...
I want to use isElementContentWhitespace on text nodes,
but not all browsers support it, so I need to check if its supported,
then if is, use it, if not implement jquery's $.trim...
i've tried doing something like this with no luck on IE, good on FF:
var testEl = document.createElement('span');
testEl.innerHTML = ' ';
alert( testE...
Hello. In Google Chrome, the following code snippet:
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
<script type = "text/javascript">
<!--
function onBodyLoad()
{
var x = 42;
document.writeln("x = " + x);
alert("on load");
}
-->
<...
What is the expected behavior of Javascript when you do a soft refresh on a web page?
I know that when you refresh a page, most web browsers will preserve values entered into form elements on a page. But it becomes harder to predict what will happen on a refresh when half of the page is dynamically generated.
My question is a little ...
I have two sets of code:
var holder = document.createElement('div');
var a = document.createElement('div');
a.style.float = 'left';
a.style.width = '90px';
a.style.height = '90%';
a.style.border = '1px dotted black';
var b = document.createElement('div');
b.style.float = 'left';
b.style.width = '90px';
b.style.height = '90%';
b.style....
Thanks to Chetan Sastry I have this Regex code to parse my page for a list of words and add the TM to them.
var wordList = ["jQuery UI", "jQuery", "is"];
var regExp = new RegExp("\\b" + wordList.join("\\b|\\b") + "\\b", "g");
var $elem = $("#divWithText");
$elem.html($elem.html().replace(regExp, "$&™"));
This Regex is almost wha...
Hello,
Here's my problem:
I have a div element that when it's clicked, another div shows up. Now I have no idea how to make that wherever I click on the page, this div gets removed. I mean, I know how to remove it, but which kind of events should I have in consideration to do such thing!? I can't make it with focus/blur can I. I mean I...
Hi! I'm a JS beginner. I posted this question because I've been trying to find a solution for 2 hours (it's 3:00am and I'm dying to go to bed). So thanks for understanding.
I want to get the child node of the tagname div. Then alert the name (txtPhone).
<div class="formfield">
<input id="txtPhone" name="txtPhone" />
So:
alert(docu...
In the following code snippet:
<form>
<fieldset>
<button id="indexGetStarted" class="button" type="submit">Get Started!</button>
</fieldset>
</form>
<script type="text/javascript">
$(document).ready(function() {
$('#indexGetStarted').click(function() {
$('form').submit();
return false;
});
...
$('#selectList :selected').text() is known syntax
i have to fetch the value for the same from $(this) instead of $('#selected')
something like this
$(this :selected').text() ?
...
I already know how to check elements that are there when the document is ready:
jQuery.fn.exists = function () {
return jQuery(this).length > 0;
}
But this method doesn’t know elements that are added with AJAX. Does anybody know how to do that?
...
So I tried the trusted google but found no satisfactory solution. Basically, I'm not sure if what I'm doing should work.
I want to make an ajax call that returns a JSON result. I iterate over this result and write a string like this and push to #results span (all of this works fine):
var str='';
for (var n=0;n<data.length; n++){
st...
Hello,
For a JavaScript library I'm implementing, I need to clone an element which has exactly the same applied style than the original one. Although I've gained a rather decent knowledge of JavaScript, as a programming language, while developing it, I'm still a DOM scripting newbie, so any advice about how this can be achieved would be...
I'm somewhat new to jQuery/javascript, and would like to compare the contents of row[i] in a table body with row[i+1].
Is this something I can do with jQuery or should I just use plain old JS and getElementByid and then loop that way? using the .each doesn't appear to give anyway of accessing the next element in the series easily.
I a...
here is the case. with jquery ajax call i have added a new link < a id="new_link >
and i want to use jquery on that newly added link:
$(document).ready(function(){
$.post("static/js/jquery_call.php", function(data){
$("#div_id").html(data);
});
$("#new_link").click(function(){
..... (and so on)
but it d...
Here's my HTML:
<input id="test" type="checkbox" checked="">
Here's a Firebug excerpt:
>>> test
<input id="test" type="checkbox" checked="">
>>> test.checked = false
false
>>> test
<input id="test" type="checkbox" checked="">
Um...am I missing something, or should that last line not read the following?
<input id="test" type="che...
I'm trying to use jQuery to detect the position of a div (#olddiv), so I can use that position to place another div (#newdiv) exactly below it. The right borders of the 2 divs are aligned (right border).
I'm trying to get the #olddiv bottom and right locations to use them as the #newdiv top and right borders. I've used this code, but i...
I've this piece of HTML:
div.content
div.one
content
div.two
content
div.three
content
I want to add two divs on top and bottom and wrap one div around it so it becomes:
div.top
div.wrapper
div.content
div.one
content
div.two
content
div.three
content
div.bottom
I'm aware of the sev...
Hiya,
I have a section on our website that loads quite slowly as it's doing some intensive calls. Any idea how i can get a div to say something similar to "loading" to show while the page prepares itself and then vanish when everything is ready?
Cheers
...
I'm looking for close event for popup. I've found one for XUL, but I need it for HTML.
Popup has closed property.
>>> var popup = open('http://example.com/', 'popup', 'height=400,width=500');
>>> popup.closed
false
Well, I can check it once at half second.
function open_popup() {
var popup = open('http://example.com/', 'popup', 'h...