javascript

JavaScript on jQuery created code never gets called

This is my view in ASP.NET MVC. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Administration.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server"> <script type...

Using HTML Canvas for UI elements?

Hi, I have a couple of UI elements such as buttons in my web application. I was going to use CSS3's transitions to animate the transition from one background-image to another. I figured out that it's not possible with the current transitions draft at least. So, I was wondering if it would make sense to use Canvas as the button. I'm sure...

Strange JavaScript syntax error from an AJAX call to PHP

Hello, Long time reader, first time poster. Any help is greatly appreciated. I have crafted an AJAX query using JavaScript. The script works correctly, and the interface does what I want, but Firefox is giving me an error message related to the PHP file being hit. It's strange, because it seems to suggest there's a syntax error in t...

Replacing multiple patterns in a block of data

I need to find the most efficient way of matching multiple regular expressions on a single block of text. To give an example of what I need, consider a block of text: "Hello World what a beautiful day" I want to replace Hello with "Bye" and "World" with Universe. I can always do this in a loop ofcourse, using something like String.repl...

How to access radioButton individual items?

Hello, I've got 2 radio button groups showed differently depending on the value selected on another radio button. The thing is that I would like to set the default value of the group to the first element in the radiobutton group, but when I change from the other radio button it preserves the value previously selected, when I want it t...

Multiple forms with shared fields

How to make multiple forms with shared fields? <input type=text name=username /> <form action="/users"> ... some fields ... </form> <form action="/admins"> ... some another fields ... </form> ...

How to pass db2 values to jQuery grid

Hello friend, I have a db2 table with certain columns. I have a stored procedure for select all table Can anybody tell me how to use this stored procedure to fill the json grid. Using asp.net mvc control.. thanks ...

JavaScript Error line 1 <ANYJAVASCRIPFILE.JS> SyntaxError: Parse error IN Iphone mobile safari

Hi, I keep getting this error when I run my web app (asp.net mvc) in the mobile safari (ITouch) JavaScript Error line 1 SyntaxError: Parse error JavaScript Error line 1 SyntaxError: Parse error I have no problem running this in any other browser (including safari). I suspect this is something to do with mobile safari handling...

jQuery: Sort div's according to content of different sub divs

I'm trying to create a somewhat complex sorting feature which neither uses divs nor lists. Unfortunately two hours of googling didn't help me. Here is the basic setup of my HTML: <div id="all_elements"> <!-- one element --> <div class="element"> <div cla...

MVC 2 Ajax.Beginform passes returned Html + Json to javascript function

Hi, I have a small partial Create Person form in a page above a table of results. I want to be able to post the form to the server, which I can do no problem with ajax.Beginform. <% using (Ajax.BeginForm("Create", new AjaxOptions { OnComplete = "ProcessResponse" })) {%> <fieldset> <legend>Fields</legend...

Facebook connect JavaScript with PHP

I'm using the JavaScript method to sync/login (with the popup) with Facebook Connect on my site, it seems to work. However, after I get logged in, I want to continue in backend, with the PHP library. I see the cookies are set by the JavaScript lib, but I don't know how to use them with the PHP api. I used $fb = new Facebook($api_key, $s...

cannot set selectedIndex off select with javascript

Hi, I have this code and I keep getting undefined if I test the selectedIndex. alert(x.selectedIndex); So, setting it is also a problem. Does anyone possibly see what the problem is? //makes list off tags function ttyps_select(data,naamsel,selectid, containerid){ if(!ttyps.length){ jQuery.each(data, function(index, itemData) {...

How do I force a scrollbar in a <select> to go to the top of the list?

I have this HTML: <select multiple='multiple' size='3'> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> Using jQuery how do I force the scrollbar in the select to go to the top? ...

Javascript calling JSF handler method

Hi All, I am reading an xml file using javascript and then I need to submit my form so that it calls a particular method in my JSF handler. Usually this can be done on a jsp when user clicks a button by having an actionlistener like so: <h:commandLink styleClass="button" action="#{myHandler.outcome}" actionListener="#{myHandler.doNext}...

Can somebody tell me why this Jquery tooltip is not showing up?

<link rel="stylesheet" type="text/css" href="jquery-tooltip/jquery.tooltip.css"/> <script type="text/javascript" src="jquery-tooltip/jquery.tooltip.js"></script> <div id="baby" title="My tootip">The text</div> <script type="text/javascript"> $(function(){ $('#baby').tooltip({ track: true, delay: 0, showURL: false, s...

How can I embed the result of a web page into another webpage on another website?

I would like to allow users to call my ruby on rails app as a service which returns a 'div' with html content in it, and embed that div into their app (which will not be a rails application). For example, assume someone has their own php website that has a header/footer template that gets rendered, and a content area of the page that ...

Ways to access a JavaScript Object's Property in IE6

I have a JavaScript object with some properties. Lets say: var haystack = { foo: {value: "fooooo"}, bar: {value: "baaaaa"} }; Now, I want to access one of those properties, but I don't know which one. Luckily, this variable does: var needle = "foo"; In modern browsers I seem to be able to do the following and it works: haystac...

Jquery Keypress is not working for my input box.

$("#epFilter").keypress(function(){ query = $("#epFilter").val(); alert(query); }); In this code, whenever I type in my text box, it always alert one character less. It doesn't catch the last character. Why? ...

How to append html to first occurance of string after selected element

Hello, I have html like so: <div class=foo> (<a href=forum.example.com>forum</a>) <p> Some html here.... </div> And I want to insert another link after the first one, like so: <div class=foo> (<a href=forum.example.com>forum</a>) <a href=blog.example.com>blog</a> <p> Some html here.... </div> ...but because it is enclo...

Comparing large strings in JavaScript with a hash

I have a form with a textarea that can contain large amounts of content (say, articles for a blog) edited using one of a number of third party rich text editors. I'm trying to implement something like an autosave feature, which should submit the content through ajax if it's changed. However, I have to work around the fact that some of th...