jquery

Should developers trying to utilize the best of jQuery still be using ThickBox 3.1

Is this still the recommended library in use? ThickBox 3.1 ...

How to check if an embedded SVG document is loaded in an html page?

I need to edit (using javascript) an SVG document embedded in an html page. When the SVG is loaded, I can access the dom of the SVG and its elements. But I am not able to know if the SVG dom is ready or not, so I cant' perform default actions on the SVG when the html page is loaded. To access the SVG dom, I use this code: var svg = do...

JQuery: Build HTML in 'memory' rather than DOM

Is there a way to 'pre-build' a snippet of HTML before adding it to the DOM? For example: $mysnippet.append("<h1>hello</h1>"); $mysnippet.append("<h1>world</h1>"); $("destination").append($mysnippet); where $mysnippet doesnt exist in the DOM. I'd like to dynamically build up some lumps of html and then insert them into the page at ap...

jQuery - $.each loop through json code

Due to the way my serverside script outputs I receive multiple JSON objects. {jsonhere}{jsonhere1}{jsonhere2}{jsonhere3} etc.. They aren't seperated by anything. If I would do a split based }{ I would lose those brackets. So is there an outerloop I can put over the regular $.each loop to make this work? Thank you, Ice ...

JS: var self = this?

Using instance methods as callbacks for event handlers changes the scope of this from "My instance" to "Whatever just called the callback". So my code looks like this function MyObject() { this.doSomething = function() { ... } var self = this $('#foobar').bind('click', function(){ self.doSomethng() // this.doSomethi...

'JQuery' is undefined

I am working on a ASP.net project created with local file system settings. I am using MVC and Jquery. Jquery is working fine when I run the application in debug mode i.e. in ASP.net Development server. I am trying to host the application in IIS 7. In hosted mode, it does not recognize Jquery and gives scripting error 'Jquery is undefined...

animate opacity out, insert html, animate opacity in

With my jquery I'm trying to make the transition from a message to a loading function easy on the eyes by animate the opasity of the message out, inserting the loading.gif and animating the opacity back in. It fails. $('#powerSearchSubmitButton').click(function(ev) { startLoad(); return false; }); function startLoad() { $('....

How do I add an option to a select box in a parent window using jquery?

In my child window I have $('#opfile').addOption("someval",sometext"); Problem is #opfile is an a parent widow I cant get it to communicate I tried window.opener.$('#opfile').addOption("someval",sometext"); but no luck any ideas? Update Embarssing but I got the above to work might have been caching something Thanks for the sugg...

Clicking twice to activate? javascript onclick issue

Hi! I'm having an issue with a project I am working on at the moment that is making use of the Validation plugin for jQuery, when the validation error appears I am dynamically applying an anchor tag to it with an onclick. And its this onclick thats the problem... The first time the validation error appears I have to click the link twic...

ASP.NET jQuery - Bound Controls

I want to use jQuery with a GridView which contains textboxes, but I'm stuck on how to get event listeners registered for every textbox on the selected row. I was thinking I could do something with a StingBuilder in the Unload event of the GridView but I can't get it working. ...

Switching an image using jQuery

Is there a better, more jQuery-ish way of handling this image substitution? var image = $(obj).children("img"); if ($(image).attr("src") == "Images/TreeCollapse.gif") $(image).attr("src", "Images/TreeExpand.gif"); else $(image).attr("src", "Images/TreeCollapse.gif"); ...

Using jQuery how do you prompt a message with a select menu option?

I need to prompt an alert message when a user selects a particular option in a select menu. Is there a way to do this using jQuery? ...

How can I determine the element type of a matched element in jQuery?

I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html(). $("[id$=" + endOfIdToMatch + "]").each(function () { ...

Shorten URL value as Javascript variable

I'm using the jQuery Treeview plugin for navigation on a site with nested levels of categories. In each category there are then products, each of which have one or more information types. So my URLs can be either: foo.com/view/cat_id/ foo.com/view/cat_id/prod_id/ foo.com/view/cat_id/prod_id/info_id/ Trouble is, the navigation for th...

How do I slideDown whilst maintaining transparency in jQuery?

I'm trying to animate a block level element using jQuery. The page loads with the element styled with display: none. Id like it to slideDown whilst transparent and then fadeIn the content using the callback, however slideDown appears to set the visibility to full before fadeIn is called, resulting in the content being visible during the ...

jQuery Selector

I want to achieve going to the parent element then to the prev element get the atrribute id of the element which has class: classname. <div> <span><span id="190" class="classname">blabla</span></span> <span><a href="#" class="button">blabla</a></span> </div> Pseudo code: $('.button').click(function(){ console.log($(this).parent()...

Is there a jQuery Click method?

I'm trying to click on a link using jquery. There only appears to be a click event that replicates "onclick" (i.e user input). Is it possible to use jquery to actually click a link? ...

jQuery bind error "event is not defined"

Currently I'm doing something like this in markup <input type="text" ONKEYPRESS="InputNumeric(event);" id="txtNumber" /> But I want to use the jQuery bind method instead for all the obvious reasons. jQuery(function($) { $("#txtNumber").bind("keyup", InputNumeric(event)); }); But when I try the above I get the below error "ev...

Is it possible to reference ViewData within a script block in ASP.NET MVC?

I'd like to add a click handler for a button using jQuery, but the handler needs to reference data supplied by the controller. Is there a way to access ViewData in a script block in ASP.NET MVC? Or do I need to construct the script in the controller? ...

Modifying form data before submission

I'm using jQuery in conjunction with the form plugin and I'd like to intercept the form data before submission and make changes. The form plugin has a property called beforeSubmit that should do this, but I seem to be having trouble getting the function I specify to run. Here's the markup for the form (some style details omitted): <f...