dom

How might I use jQuery to show the first 8 elements?

I have a list of items (<li>), something like 50 of them, and I want to show only the first 8 items... How can I do that? ...

IE support for DOM importNode

I've been looking arround the web, and I'm fairly sure I already know the answer ("no"), but I'd like to check: Does IE support importNode() yet? Is there a better alternative than walking the DOM and creating nodes? (I've seen the clasic article by Anthony Holdener but its more than a year old now, and I'm hoping that either IE has evo...

Convert string into jQuery object and select inner element

I wonder if there is a way to convert string into jQuery object and select inner elements without injecting the whole string into DOM and manipulate it in there. Thanks. If possible, please give me example of converting <div id=a1><//div> <div id=a3><//div> And select a1 from the object variable Thanks ...

problems getting the values of a select element-

struggling to get the value of a selected item html- <select name="recommendFriend" onChange="friendWall(127);return false;" id="recommendFriend"> var user = document.getElementById("recommendFriend").getAttribute("value") im using JS on facebook ...

Create a modular website, allowing the user to select their page layout. PHP and jQuery advice?

Hello, I am looking to build a website that allows the user to fully customise the content that they see. I will be building this using CodeIgniter or Zend Framework and also jQuery. What I need to know and gain some advice on is how is the best way to create the content on the fly, When a user selects that they would like the blog s...

Is it possible to create a div element with jquery onclick of a link

Hi, I have a navigation list, the effect I am wanting is for when the user clicks on a link an accodian style div is built and displayed by jquery, then if the user clicks the same screen the is deleted from the screen, could someone suggest how this could be achieved I have been searching google with no luck. Thanks ...

How to master Document Object Model (DOM) ?

Been using Javascript libraries like Prototype and jQuery for development, for a while now. While its a boon using those libraries, the one downside is that using such libraries probably doesn't help in understanding what happens under the hood. So how does one master DOM? Will understanding DOM be of more help when using Javascript...

Flash, LocalConnection and DOM

I have a Flash object on my site, which has this code: this.ld = new LocalConnection(); this.ld.allowDomain("*"); ExternalInterface.call("alert", this.ld.domain); It alerts my domain successfully. However, what I want is to access the HTML DOM through this using LocalConnection and not ExternalInterface directly. Any ideas? ...

How do Rich Text Editors in HTML documents achieve their rich text formatting?

Could you please explain how the text in the textarea gets styled in rich-text editors? I've tried to style text in the form but it doesn't change. Is it JS that recognizes characters typed by the user? How's that done? Edit: After a bit of research (Google rules!), I've found some excellent information. For others who might be inte...

DOM vs Array - memory use

For example I have a list of 100 strings, and 100 span's with this strings. How do you think, how much span's takes more memory than array of strings. Is there possibility to measure? Is there optmisation to unvisible DOM? ...

How to highlight HTML text without wrapping it with tags?

Is it possible to highlight text in an HTML document using without wrapping it with <span> or any other tag for that matter? For example, in the HTML code <p>The quick fox</p> I would like to highlight quick but without adding a DOM element around it. Adding a DOM element to a parent element is fine. Thanks! ...

Image Upload -- showing image on web page before hitting Submit

To better learn web development, I'm trying to write a PHP page that will let me upload and download files from a server, which I've done in ASP before. I am however, tripping over something that reason says should be simple, but I'm not able to find an answer for it. Here's the pretty standard code for the browse/submit: <form enct...

Clicking a link when enter key is pressed using jQuery

I'm trying to make it so when a user is in a text box and they press enter, it is the same as clicking the link, in which case it should take them to another page. Here's what I have and it doesn't work. The code //jQuery $(document).ready(function() { //if focus is in the input box drivingSchoolInput $("#drivingSchoolInput").li...

HTML scraper to remove and modify html pages?

I need a HTML scraper or a DOM editor. I know the question has been asked many times, and the answer is HTML agility pack. But it doesn't look any good to me. I tried to removed a simple form element, but it removed only the <form> tag and leaved all other tags inside it, also it leaved the </form> tag. I used the PHP Simple HTML DOM Par...

HTML DOM width + height of visible window

How do I get the current height and width of the available space in the browser as it is open. I don't want the height of the total document, just what's visible on the screen. ...

Hiding the text input cursor (the caret) showing through overlayed elements Internet Explorer

I have a form with a special widget that fills in a text input. When the text input has focus, the widget appears above the text input (intentionally above it) and the user clicks options in it, when they're done it disappears and fills in the input. There is a problem with this in IE, when the widget appears above the input, the field's...

Javascript is telling me a node has 23 children, but it only has 11 and firebug agrees with me.

Im working on a HTML test page with a simple grid that has red or blue squares. If you click a red square it should be blue, if you click a blue square it should change to red. Sounds easy. I have it set up so there are rows with id's r + rownum. In my testfile i just have 2 rows: r1 and r2. Each row has the same number of children (rig...

What defines the availability of the DOM `document` property in the javascript global object?

I am a bit new to javascript and was trying to understand how the W3C DOM standard and javascript as defined by ECMAscript interoperate. Specifically, as I understand it: the ECMAscript standard defines the existence of a Global Object, which provides functions such as parseInt(string) and explicitly allows the presence of other built-...

howto append something to an empty body with jquery

I am doing this with jquery $().ready( function() { $(document).empty(); $(document).append("<div>hallo</div>"); }); I would have expect it to empty the body and afterwards add an div with hallo into the body. But it doesen't. In firebug it does not show any errors. Why does it not work and how do I make it work? ...

How do I give an HTML canvas the keyboard focus using jquery?

I am implementing a game using Javascript, jquery, and the Canvas tag. How can I prevent the browser from processing keyboard shortcuts when the canvas tag has the focus? I have tried event.stopPropagation() and it has no effect. I can pick up keyboard events. However, when the user presses the spacebar, the web page scrolls down in Fir...