How to get element by class name?

This question already has an answer here: How to Get Element By Class in JavaScript? 11 answers

ASP.NET postback with JavaScript

I have several small divs which utilizing jQuery draggable. These divs are placed in an UpdatePanel, and on dragstop I use the _doPostBack() JavaScript function. where i extract necessary information from the pages form. My problem is that when i call this function the whole page is re-loaded but i only want the update panel […]

How to make jQuery to not round value returned by .width()?

I’ve searched around and couldn’t find this. I’m trying to get the width of a div, but if it has a decimal point it rounds the number. Example: #container{ background: blue; width: 543.5px; height: 20px; margin: 0; padding: 0; } If I do $(‘#container’).width(); it will return 543 instead of 543.5. How do I get […]

Is it possible to override JavaScript's toString() function to provide meaningful output for debugging?

When I console.log() an object in my JavaScript program, I just see the output [object Object], which is not very helpful in figuring out what object (or even what type of object) it is. In C# I’m used to overriding ToString() to be able to customize the debugger representation of an object. Is there anything […]

Javascript heredoc

I need something like heredoc in JavaScript. Do you have any ideas for this? I need cross-browser functionality. I found this: heredoc = ‘\ <div>\ <ul>\ <li><a href=”#zzz”>zzz</a></li>\ </ul>\ </div>’; I think it will work for me. 🙂

Jquery selector input[type=text]')

I wrote a code that basically selects all input type=text element like this: $(‘.sys input[type=text]’).each(function () {} How do I change it to select input[type=text] or select?

Chrome, Javascript, window.open in new tab

In chrome this opens in a new tab: <button onclick=”window.open(‘newpage.html’, ‘_blank’)” /> this opens in a new window (but I’d like this to open in a new tab as well: <script language=”javascript”> window.open(‘newpage.html’, ‘_blank’); </script> Is this feasible?

jQuery-UI's autocomplete not display well, z-index issue

I’m currently implementing jQuery UI’s autocomplete in my clients webshop. The problem is: the element the autocomplete resides in, has a higher z-index then the z-index of the autocomplete. I tried setting the autocomplete z-index manually, but I’ve got the feeling that jQuery UI is overwriting this. In fact my question is a duplicate of […]

JavaScript .replace only replaces first Match

var textTitle = “this is a test” var result = textTitle.replace(‘ ‘, ‘%20’); But the replace functions stops at the first instance of the ” ” and I get the Result : “this%20is a test” Any ideas on where Im going wrong im sure its a simple fix.

How does AJAX work?

What is the essence of AJAX? For example, I want to have a link on my page such that when a user clicks this link, some information is sent to my server without the reloading of the current page. Is that AJAX? I was able to get this behavior by using isoframes. In more details […]