javascript

Remove HTML Tags in Javascript with Regex

I am trying to remove all the html tags out of a string in Javascript. Heres what I have... I can't figure out why its not working....any know what I am doing wrong? <script type="text/javascript"> var regex = "/<(.|\n)*?>/"; var body = "<p>test</p>"; var result = body.replace(regex, ""); alert(result); </script> Thanks a lot! ...

jquery image load/replacement

Hi, I am having some trouble figuring out why I cant load an image with jQuery. It seems to me a browser cache problem, but I am not sure. I am doing an ajax call that returns me the path of some generated image. On the complete method I want to replace the existing image that I have for this new one. What happens is that the src of the ...

Jquery Add Values to Select Options

i have google this option many days but i did't find it. what i want is: I have two Select BOX First Select box Have Country Names Second Select Box is Empty what i want is when i select any country (i.e United Kingdom) from first select box, a php query should run to get all cities name from table then add them to second select bo...

Collecting a huge amount of data on a webform, best methods?

Hey all, I need to allow users to choose/input authors associated with a given publication and there could be just a single author or (43 = the most I have seen so far) up to 40+. Needless to say creating a static form to collect the data will not do since there is no way to know ahead of time how many authors there are. My original ...

Simple way to clear the value of any input inside a div?

Hi all, Is there a simple way to iterate over the child elements in an element, say a div, and if they are any sort of input (radio, select, text, hidden...) clear their value? TIA for any helpful links or advice. David Edit to add link to example solution code. Many thanks to Guffa and the other respondents! I learned from this! ...

Buildling an array of vaules from page elements in JQuery/Javascript

I have a set of text boxes in which the user inputs an email address into each one. I want to loop around these and build an array of them. How do I do it? var emailAddresses = new Array(); $(".email_address").each( function() { //add this $(this).val() emailAddresses ...

javascrpt to hide parameter and navigate to the next page

" ONCLICK="javascript:submit();" CLASS="link_btnPrimary">Enroll When the enroll button is clicked on the page, it navigates to the next page along with parameters as shown above visible on the a...

Best practices for using multiple Javascript libraries on the same page?

I have thought hard about what library would be best, but any library "X" would be missing a certain feature from library "Y". What are peoples' thoughts on using mutliple JavaScript libraries simultaneously? ...

detect url's in text with Javscript/Prototype.js

Does anyone have suggestions for detecting url's in a set of elements and converting them to links? $$('#pad dl dd').each(function(s){ //detect urls and convert to a elements. }); ...

Palm Pre and Visual Studio. Possible?

The development experience for the Palm Pre sucks, to say the least. At best you are working on JavaScript in Eclipse with the Aptana plugin. The intellisense you get is really, really dismal. You have to be looking at the documentation every 5 seconds. I was thinking, Visual Studio really excels at JavaScript and intellisense. Has ...

Javascript onresize event

If I have this window.onresize = function() { alert('resized!!'); }; My function gets fired multiple times throughout the resize, but I want to capture the completion of the resize. This is in IE. Any ideas? There are various ideas out there, but not has worked for me so far (example IE's supposed window.onresizeend event.) ...

Need a sortable JavaScript table which can handle real-time updates

I need a sortable table or grid widget in JavaScript which can handle real-time updates. I will be updating rows within the table via updates from Comet and preferably don't want a widget that requires me to redraw the whole table on each update or hogs the CPU when updating. ...

JQuery - work with divs

Hello, I want to set another class for the clicked menu-part. Clicking generates url with #NAME. Here is my menu: <div id="head_menu"> <a href="#order"><div name="order" id="menu_part">make order</div></a> <a href="#portfolio"><div id="menu_part">portfolio</div></a> <a href="#contacts"><div id="menu_part">con...

trouble with nested html and a dojo store fetch

I am attempting to create an html table that joins GIS Map output with a dojox csv store. This is performed through a series of function calls. The resulting behavior is that in IE, I need to fire (onclick event on the map) the parent function twice to get the joined data (ChildFoo) from the csvStore to appear. It's like the parent fun...

How to pass parameters in eval in an object form?

Hello, I have this json, and when i get this json i need to run the function which comes at callback object. { formId: 'snn_service_item_form', item_id: '1', item_title: 'some item', item_description: '', item_duration: '10', item_price: '120', item_level_1 : 1, item_level_2 : 0, item_level_3 : 1, ...

Binding click event to appended link with jQuery

I've got a lightbox that uses jQuery's $.ajax to retrieve data. If i get back no data, then I append a "no data found" message to my list, and a link to reset the search parameters. Basically I'm trying to add a .click() event to a link that I've appended. The problem is that the function is running immediately, not waiting for a clic...

GMarker with zoom function

I've been fighting with this for a while, so I think it's better to ask the big guys. I have the following function which I use to creage GMarkers with some information function createMarker(data, html) { var marker = new GMarker(new GLatLng(data.latlng.y, data.latlng.x)); var html = "Provider: "+ data.name.data + "<br...

asp.net ajax 4.0 client templates, how to bind a select?

I am trying to create a simple ajax grid that allows me to add and remove rows and also edit some of the columns and have others columns calculated directly based on the input in the others. I thought this would be a nice oppurtunity to play with asp.net ajax 4.0 and the client templates. It works pretty ok but I can't seem to find a way...

How do I encode an HTTP link... something very easily with javascript?

<a onclick="go_url(ENCODED-URL);return false;">go to this url</a> ...

javascript array sorting

barValues is an array I'm passing to a function. Within the function I have this: alert(barValues); var sortedBarValues = barValues; sortedBarValues.sort(function(a,b){return b - a}); alert(barValues); I'm trying to end up with two arrays. barValues being the original array and sortedBarValues being a copy of that array, now sorted....