jquery

Jquery using wrapAll

I need to find all the p tags inside all the divs with a class of someClass and wrap them with another div. This is how the beginning mark up would look like : <div class="someClass"> // Lots of different tags generated by the site <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> </div> <div class="som...

pulsing menu items

I have a menu setup with the below css: a.menu:active { color: #000000; } a.menu:hover { color: #FFFFFF; background-color:#000000; text-decoration: none; } I am looking for a way to make the background color of certain items pulse in and out. Slow fade from one color to another. Or fade betwe...

Authoring jQuery Plugin, add property to jQuery Object

Hi, I'm trying to write a plugin that creates a ul-list. Got it to working, but I can't figure out how to se if it's already loaded. I believe it's due to that it creates a new instance each time I call it. Is there a way around this. I use this code for the plugin: $.fn.addResultList = function (options) { var constructor = $('<...

mootool set value to div

i am using mootools i have div in body with like this <div class="total-title">12</div> total-title i am using for reference. my mootools code is $('total-title').set('text', 'text goes here'); i want to change text of above div. this is not working...? Thanks ...

Using jquery to get element's position relative to viewport

What's the proper way to get the position of an element on the page relative to the viewport (rather than the document). offsety/x seemed promising: http://docs.jquery.com/CSS/offset But that's relative to the document. Is there an equivalent method that returns offsets relative to the viewport? ...

jQuery (anti-)pattern: building selectors with string manipulation

Too often I find myself building selectors with string manipulation (split, search, replace, concat, +, join). Good or bad? ...

jquery append to window

how can i append a div directly to the window object? <html> <head> </head> <body> <div><div> <ul>..</ul> </body> </html> and i want to append an element after the ul, but not something like $('ul').after(element), i just want to append it directly to body. thanks ...

Is there a way to add a "None" option to the standard jQuery datepicker?

I am trying to implement the standard jQuery datepicker control ... I am trying to move away from BasicDatePicker, which I use in a variety of my ASP.NET Web Forms projects. That aside, the BasicDatePicker did have a great option, which was the ability to display a None button. When the user selected the None button it would clear the ...

jquery ajax encoding issue

$("#footerform").submit(function(){ $.ajax({ type: "POST", url: "contactrespajax.asp", data: $("#footerform").serialize(), success: function(){ $("#footerform").hide("slow"); $("#result").show("slow"); } }); }); it is submitting a contact form which is sent to my email using ASP CDO.Message. when i sub...

Is it Ok to pass jquery objects to different functions?

I am doing the following : $(function() { var $txt = $("#text1"); callMe($txt, $txt.val()); }); function callMe(t, vlue) { t.html(vlue) } I will be calling the callMe() function multiple times. Is it Ok to do the way i have shown or is there a better way? ...

browser textbox autocomplete event, when does this happen?

If i dont put autocomplete="off" on my <input type="text" />s the browser will sometimes fill them in with likely/remembered data. When does this happen in the DOM-load-lifecycle? It appears to be after: $(function(){ alert('i happen before autocomplete'); }); Is there a dom-load event which occurs after form-autocompletion? If s...

Best way to use jQuery's .ajax() function retrieve variables from a php script?

-I have read about json being a simple way but also read its a bad practice to use eval() once the data is retrieved. So I don't know how so use the data returned. -The only way i've been able to retrieve data from php scripts is if I echo the results already formatted (which is not very convenient). Also if there is a redirect in the p...

jquery jeditable pass multiple values...

Alright totally new to jeditable, Say I have some <div>'s and <input type='hidden' /> items that are generated dynamically with PHP like this: <?php while($row = $db->fetch_assoc($query)) : ?> <input name="hiddenID" type="hidden" value="<?php echo $row['id'] ?>" <div class="items"><?php echo $row['item']; ?></div> <?php endwhil...

jquery scope issue

I am having issue with the following: I can't seem to keep the link I am selecting in each repeated item. The word "this" is getting lost. the Var event_id works for each element, but the var $something is undefined? Why is that, Ideally I wanted to do a switch statement but same issue, can't seem to get it to know what link I click an...

Anchor tag, to go to the beginning of a div class w/ USING jQuery

I want to implement a global anchor type of functionality. I want to include a link to the main part of the web page, globally by inputting into my header.inc file. When you select the link, it will scroll to the main part of the page, which is within the div class content-body <div class="content-body"> main content </div> So it ...

How do I get the ID of the currently selected jQuery UI Tab?

I know that I can get the (numerical) index of the currently selected tab like this: $('.selector').tabs('option', 'selected'); Is there a way to get the ID of the currently selected tab, outside of an event handler? By "ID" I'm referring to the string property (ui.panel.id) in the ui object that's passed in as an argument to an event...

object parameters in Javascript

I'm having a bit of an issue with my javascript object. What I want to do is pass in an id and have it set a variable that is accessible to all of my functions. Here's a small sample of what I have: var myObject = function() { var pageSize = 6; var currentPage = 1; var pagerPagesVisible = 5; var pagerId = '#my-pager'; ...

populate selectlist with json data in JQuery when the selectlist is loaded (not the document)

hey guys, I have a button on a form that is dynamically spawning a select list, which is supposed to be populated with json data, i have all of the json data being pulled in correctly my only issue is hooking the selectlist's onload event to fill itself with data, i know i could use $('#itemID').fillSelectlist() to fill it but the probl...

How can I apply jQuery.click to first level items only?

Hi, I need to apply a jQuery.click to the first level items only. How do I do that? Here is my list: <ul id="adminMenu"> <li id="A"> <h3><a href="">Item 1</a></h3> </li> <li id="B"> <h3>Item 2</h3> <ul style="display: block;"> <li id="a1"> Sub Item 1 </li> <li id="a2"> Sub Item 2 </li> <li id="a3"> S...

Facebook Style AJAX Search

Hiya All, I've created a Facebook style ajax search for my site where as you type it will bring up the results in a nice list below your search. $("#s").keyup(function() { var searchbox = $(this).val(); var dataString = 's='+ searchbox; if(searchbox!='') { $.ajax({ type: "POST", url: "/livesearch.php", ...