jquery

Jquery - keeping it DRY - dynamically named functions?

So I think the best way for me to keep my code is to call a function with a dynamic name. For example, I might need to call "productTemplate", "userTemplate", "orderTemplate", etc... Is this possible with javascript/jquery? Also, is it a performance hit or not so much? ...

load different FLV video in modal window

Hi, Im using JW Player 5 to play about 10 FLA videos loading them into a modal window using swfobject. The modal window is from "lightbox_me". This is probably easier than I think but I am stuck. I can get the modal to work and load the first video, but not the second or third, it always loads the first video. The CSS #showVid1, #sh...

Get all html between two elements

Problem: Extract all html between two headers including the headers html. The header text is known, but not the formatting, tag name, etc. They are not within the same parent and might (well, almost for sure) have sub children within it's own children). To clarify: headers could be inside a <h1> or <div> or any other tag. They may also ...

user control using javascript

I want to make a kind of user control using javascript. <div id="myDiv"> <input type="text" id="myText" /> </div> I want to insert this div in my HTML markup, wherever I required. Purpose is to make it reusable at various places in my HTML and maintain a single point of change, if I need to change the control in future. I would like...

inject jquery into every ASP.Net page

Is there any way to inject JQuery into every page on an ASP.Net site without adding the script tag to every page individually? ...

Javascript IF execution error

The following is a part of my code : $.post("checkbuddy.php",function(data){ if(data!="a"){ $("#Layer15").css({ visibility: 'visible'}); $("#Layer10").css({ visibility: 'visible'}); $("#Layer10").html(data); } }); The condition if(data!="a") doesn't seem to be working, as checkbuddy.php returns "a". And what happens i...

Jquery: set get cookie, apply as class

I want to set a cookie when a person clicks on a link, then i want to get that cookie and have it somehow add the class 'pinned' to '#navigation'. I'm not too sure if this is right, i'm using the jquery cookie plugin, ugh. this is the code I have so far: to set the cookie: $.cookie('CookieName':'#navigation'); gets the cookie, adds t...

JS tabbed navigation - how keep url's working

I've built a basic tabbed interface using jQuery using this technique. I want to be able to link to the page with different tabs open. At the moment the index page loads and holds the content for all the pages in hidden divs and displays each with an animation when the tab is selected. I want to keep this functionality, but also allow d...

Trouble understanding and creating dynamic JavaScript objects

I hope my code can explain itself, I am almost there, I just am stuck on the way how to merge optional data into a JSON object with multiple levels (is that even what it is?) //get video list - example: video1.flv;test23.flv;Grabledable.flv var files = j('.videos').html().split(';'); // assume first we have one video, so no need of play...

Why does sammy.js never use post route?

OK so I just started using sammy.js , I don't it very well but I was able to get the basics working pretty quickly. HTML form I'm using <form id="contact_form" action="#/form" method="post"> <label for="name">Name:</label><input class="textbox" type="text" name="name" id="name" /> <label for="email">E-mail:</label><input class="textb...

How to avoid postback on tab click to load a page/section.

Hi Guys, I am using .NET, XSLT to achieve below functionality, however there is some challenges we are facing. I have to implement tab functionality on a page. I have got 4 different pages. 1) index.aspx 2) g.aspx 3) f.aspx 4) s.aspx tab1|tab2|tab3|tab4 (Will appear on screen) "index.aspx" will be my landing page, having the tabs co...

How to use jQuery Countdown Plugin functions

I am working on this piece of code using the jQuery Countdown Plugin it works but how ever if i try using a function with " function showPauseTime ()" I keep getting an error showPauseTime undefined. Can any body take a look at the code and tell me how I could solve this thanks $('#beginExercise').click(function() { //check if ter...

Pass the id via getJson of the item selected in a select

I have a select: <%: Html.DropDownListFor(c => c.DataTextField, Model, "Please select", new { id="selected-contract"}) %> and on change I am calling an action via $.getJSON: $("#selected-contract").change(function () { $.getJSON("/Contract/List", [WHAT GOES HERE] ,updateList); }); The bit I am struggling with is pass...

Jquery - Why am I altering elements I do no expect to be altered?

I am dynamically appending form elements. The newly appended elements need to have distinct name attributes. I am doing this by starting with a base form, grabbing a hidden set of form elements, cloning them and appending them. My problem is that when I go to set the name attribute of the new elements all of the form elements get changed...

Ok to wrap JSF components generated html with own divs using jQuery after page load?

Using RichFaces 3.3.3, JSF 1.2 and Facelets. For some presentation purposes I need to wrap the contents of some divs with other divs to be able to style them a certain way. I am using jQUery to do this as its cleaner when writing HTML and it can be controlled in one location, otherwise I have to hardcode the extra divs every place I wa...

using Jquery to reference two different forms

I am still new to Jquery and need to reference two forms, the problem is both of my forms have the same IDs. I want to get the name from form1 and populate it into form2, I would problably use this in javascript. document.form2.name.value = document.form1.name.value but i want to di the same in Jquery something like below. Can...

jquery htmldecode

how will i decode the string in the following line $("#" + result["DivName"]).append(result["SavedValue"]); ok i am using this scenario to save myself from the script attack. ok the thing is that if some one rights alert('hi') in the ckeditor . it saves in the database as it is but when i retrieves it i first encode it and then di...

jQuery regular post WITHOUT Ajax

Hi everybody, I thought this would be quite simple but the documentation doesn't point me to any solution. I am working on an editor. While i am using $.ajax for saving multiple forms at once i would like to perform the same post but with a complete page reload. how can i achieve that? Trigger Preview BTN -> Collect Forms -> Regular pos...

I need to update jQuery version for a Bookmarklet

Hi, I'm creating a bookmarklet and everything was going ok. I had a function that loads jQuery asynchronous if the page didn't have it and then load my script or load my script directly if the page had jQuery. Then I try to use the delegate function which is only available in jQuery 1.4.something. I can check the jQuery version with $()...

Opera error : Uncaught exception: TypeError: Cannot convert 'xxxxxx' to object

Hi to all again , i come today to show an error thrown by opera in Jquery ,about object transformation , here is the code ( function setColor(x,y) ): colourpixel = $('#colour').css('background-color').match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);//["rgb(0, 70, 255", "0", "70", "255"] var canvas = document.createElement('canvas'); canvas.h...