Skip to content
Advertisement

Tag: jquery

Count the number of

Is it possible using jQuery to count the number of div elements? I have this code: And get number: 3 Answer $(“#center div”).length will give you the count.

Scale and move a text smoothly with javascript

I’m having a text scaled and moved via JavaScript / jQuery. I can’t use jQuerys animate() because it has to fade in and out and has to be repeated and with more elements (end result: “flying” from the background, moving in different directions and fading out). My problem: It’s not running smoothly and causes quite the cpu-usage. Here’s a stripped

jQuery: how to change tag name?

jQuery: how to change tag name? For example: I need Yes, I can Create DOM element <div> Copy tr content to div Remove tr from dom But can I make it directly? PS: results in DOMException. Answer You can replace any HTML markup by using jQuery’s .replaceWith() method. example: http://jsfiddle.net/JHmaV/ Ref.: .replaceWith If you want to keep the existing markup,

Is there any possibility of two asynchronous Javascript function instances executing two blocks of code at the same time?

I understand that Javascript doesn’t have multiple threads, but I’d like to know if the following code has any chance of breaking. My understanding is that unless an asynchronous function is called, such as setTimeout or an AJAX call, that once a block of code starts executing there’s no way for it to pause until it completes or does call

add id to dynamically created

I have the following JavaScript that creates a div and then appends it to the body and then inserts some dynamically generated HTML into it. cartDiv = document.createElement(‘div’); This div I would like to add an id and/or a class to it. If possible both Jquery and JavaScript answers would be great. Answer If I got you correctly, it is

Advertisement