jquery

Checking for length of ul and removing an li element

I am trying to remove the last <li> element from a <ul> element only if it exceeds a particular length. For this, I am doing something like this: var selector = "#ulelement" if($(selector).children().length > threshold) { $(selector + " >:last").remove(); } I don't like the fact that I have to use the selector twice. Is there a sho...

Why is this bookmarklet code saying jQuery is not defined even though jQuery is included?

I am creating a bookmarklet and the code below is not working on first try. When I goto a page, it says "jQuery is not defined". But, if I click it again, it works perfectly? var qrcodetogo = { jQURL: 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', jQUIURL: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-u...

How to know without having iphone and ipad, any javascript/jquery effect/plugin will work on those?

How to know without having iphone and ipad, any javascript/jquery effect/plugin which is working fine on all desktop browsers, will work on iphone and ipad also? Is it enough to check on Latest Safari for Windows? I don't have MAC OSX .My os is Windows. ...

Adding li element only if it not already there?

I am constructing an <li> element like this: var element = $("<li></li>") .html(mHTML) .attr('id', "elemid"); I am trying to add this element to a <ul> element only if it doesn't already exist. Any ideas on how to do this? Am I supposed to use contains() to see if the ul element contain the html and then decide? For instanc...

xml appending issue

Any one help me? i have the xml with 2 steps. example : <listgroup title="Lifestyle" shortnote=""> <list>Type of Company: Architects may be self-employed.</list> <list>Workspace – Indoors/outdoors: Architects work both.</list> <list>Environment <sublistgroup> <sublist>Travel: Architects often visit construction sites to r...

Resolve URLs for ASP.NET in jQuery?

I would like to use "~/" and resolve on the client site. For example, I would want to do this: <a href="~/page.aspx">website link</a> <img src="~/page.aspx" /> I would have my base URLs in ASP.NET like this: <script type="text/javascript"> var baseUrl = "<%= ResolveUrl("~/") %>"; </script> Would I need a jQuery plugin for ...

in jquery, how to select current element's first child?

$(this) //this refer to the elem how to get the first child of 'this'? ...

Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument]

So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#conten...

How to Add the list item to textbox in jquery ?

Hello, I have a list <ul id="list"> <li>list1</li> <li>list2</li> <li>list3</li> </ul> and text box <input type="text" name="textfield" id="tb" value="" /> When i click a button, all the list items should be in the textbox like this list1 list2 list3 I want to do this in jquery. Please help me. ...

get all form selected lable

i need to jquery script for show or append all selected lable of chekbox , radio button , options from form to views in page . like andvanced search form , after submit show your selected options in top of result list . ...

Waiting until one event has happened before moving onto the next.

I currently have a scrolling anchor animation that also adds an "active" class to the anchor clicked. I am trying to fit the below function into the works as well, so say someone clicks "anchor 1", "anchor 1" will get an active class and the window will scroll to that location. But, after that has happened say the user manually begins sc...

Jquery flot and week numbers

I've plotted some nice graphs with jquery flot. On the x-as the weeknumber is displayed. I would like to display the weeknumbers of the winter season (oct-apr) but that is not possible 'cos flot likes a straight set (0,1,2,3,4 etc) and not (49, 50, 51, 52, 1, 2 etc). Does anyone know how to fix it? http://sionvalais.com/snowcondition/and...

Form tips with jquery or other library

This is a form validation for jquery: http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ I need something like that but the tips has to appear when I select the input text form by clicking on it and has to dissapear when I select another input text form. Is there a way to do this with jq...

How turn text links into HTML links at the client side with javascript

In my db I have saved every links in the form: www.example.com or http://www.example.com Is there a way to turn this text links into HTML links at the client side ( e.g. javascript ) with tag and parameter like this ?: <a href="http://www.example.com" rel="nofollow">www.example.com</a> ...

Contenteditable text editor and cursor position

How can I (using jquery or other) insert html at the cursor/caret position of my contenteditable div: <div contenteditable="true">Hello world</div> For example, if the cursor/caret was between "hello" and "world" and the user then clicked a button, eg "insert image", then using javascript, something like <img src=etc etc> would be ins...

Jquery onclick change value

I have some jquery tabs on my page the code for them is: //tabs options $("#tabs").tabs({ collapsible: true, selected: -1 }); I want to create a button that will toggle the above option 'selected: -1' I need it to change the value of 'selected' to '0' then back to '-1' How would I do this? <a href="#">Toggle View</a> ...

Find if id of a link equals id of parent container

Hi guys needing a bit of help. I am creating a one page personal site. Each section has a menu in it to jump to another section, however i want to have a class added to menu for the current section: i.e. if you are in about the about link would have a class 'current'. This is how it looks. <section id="about"> <nav> <li><a href=...

Looking for jQuery plugin for rounded corners that supports IE6

Does anyone know a jQuery plugin for creating rounded corners for div elements that supports also IE6 ? I'm interested in a cross browsers solution, and the plugins that I saw so far didn't work well with IE6. Thank you very much ! ...

Help with jQuery issue

I have a simple page with a list of items. I am allowing users to vote on these items, but I only want to allow the user to vote once per. item. I made a jQuery script that adds a class to the items the user has voted on: if(!$(this).find(".item span").hasClass("voted")) { $(".item").hover(function() { $(this).find(".ratingbar")...

Jquery destroy dialog box after x seconds

How can I destroy a dialog box after a certaing amount of seconds????? This is my code: <script type="text/javascript"> $(function() { $(".dialog-message").dialog({ modal: true, buttons: { Ok: function() { $(this).dialog('close'); } } }); }); </script> ...