Skip to content
Advertisement

JavaScript infinite up and down element scrolling?

I’m wondering if there is a simple way to make use of JavaScript (probably jQuery too?) in order to make the contents of a fixed-height div element scroll infinitely up and down (top, bottom, top, bottom, etc) when the page loads and without any user input or manipulation? Thanks ahead of time, any input is greatly appreciated as I am

Javascript showing in dollars

How would I display JavaScript output numbers in dollar format? I.E. $20.00 then $2,000.00 when the number gets larger. Ok so sample code. Answer Here’s the function that I use.. Basically the same as @Senad’s except it adds commas:

find element based on tabindex

Using jquery or javascript, how can I find the input element in the DOM that has a particular tabindex set to it, eg. I would want this element returned if I was searching for the element with tabindex = 7. Answer You can get it with the following jQuery

How do I hide javascript code in a webpage?

Is it possible to hide the Javascript code from the html of a webpage, when the source code is viewed through the browsers View Source feature? I know it is possible to obfuscate the code, but I would prefer it being hidden from the view source feature. Answer I’m not sure anyone else actually addressed your question directly which is

How can I put [] (square brackets) in RegExp javascript?

I’m trying this: And the replace doesn’t work, what am I doing wrong? UPDATE: I’m trying to remove any square brackets in the string, what’s weird is that if I do it works, but replace(/[]/g, ”); doesn’t. Answer It should be: You don’t need double backslashes () because it’s not a string but a regex statement, if you build the

How to get Events associated with DOM elements?

I have an HTML document. It is possible to get the events associated with every Element in a particular FORM element in the document using JavaScript. This way I can get jth element in ith form, But can I get the event associated with the element. There can be any number of elements in a form. I am using IE

Pure javascript method to wrap content in a div

I want to wrap all the nodes within the #slidesContainer div with JavaScript. I know it is easily done in jQuery, but I am interested in knowing how to do it with pure JS. Here is the code: I want to wrap the divs with a class of “slide” collectively within another div with id=”slideInner”. Answer If your “slide”s are

Simple version of jQuery live function

Is it possible to get anywhere a pure Javascript function for event handler with similar functionality as jQuery’s live() ? I need to have the ability to attach events to objects not yet created but both jquery-livequery as well as jquery-events sources are not useful due to dependencies on jQuery core. Answer Event delegation is quite simple. Take this example:

Advertisement