jquery

How to add JavaScript if the URL has a certain word ?

I want to add the the following jQuery to the following pages only. http://www.mywebsite.com/check-8.asp http://www.mywebsite.com/edit-8.asp http://www.mywebsite.com/cart-8.asp So this means I want to add it where URL string contains either check-8, cart-8 or edit-8. What is the best way with jQuery or JavaScript? var text = $('...

[jquery ajax] set ajax response as global variable

Hi, I'm currently messing with google's apis using ajax trough jquery library. In order to use a google service API i need to get an auth token sending a request to ClientLogin. Actually, i've no idea how to pass the token to the second request . I've set a global variable token as var token = null; I call two requests on $(document)...

Is it worth coding for users who may not have JavaScript enabled?

Possible Duplicates: How safe is it to assume that most users will have JS enabled? Is it reasonable to assume my visitors have javascript enabled? I'm worrying about this and don't know if I should be. ...

What would be the best approach to pop up an alert if $_POST['value'] is in the database?

I'm making a script where a user enters a value and clicks Submit. However, I want it to pop up an alert asking if they are sure, if the value is already in the database. I was thinking of doing this with AJAX, but a friend of mine is a jQuery fanatic and told me to go with that instead. What would be better for this task, and how would...

jQuery/PHP: sliding up even if its not :last

I want to slide up #FriendRequests (a bar) if its the last friend request the user is answering on (confirm/ignore). When you answer confirm/ignore, it sends ajax call and on success i made this: $('#FriendRequests:last').slideUp('slow'); But my problem is now, that even if its not the last friend request you are answering on the #Fr...

Equivalent to .append for a list element

I have: <div id="list"> </div> and then: $('#list').append('a<br>'); $('#list').append('b<br>'); $('#list').append('c<br>'); But what I would like is: <ul id="list"> </ul> Q: How can I append to an unordered list in jQuery using the DOM and not using .html? ...

jQuery - How to hide drop down search result list?

Hi! I'm trying to do a search user bar like the one in facebook (it consists in a input area and a dynamic drop down result list) but I'm having problems in hiding the drop down result list list when I click in another area. the html code is something like this: <div id="search_container"> <input id="search_imput" type="text" autoc...

replaceWith is not replacing the attributes of the top id

<div id='one' class='foo'>Hello</div> $('#one').replaceWith("<div id='one'>World</div>") Above code is producing <div id='one' class='foo'>World</div> However the desired output is <div id='one'>World</div> Notice that replaceWith is changing the content inside the div but not the attributes of the div itself. ...

Strange problem with jQuery when using Ajax

Im using jQuery/PHP/MySql to load twitter search results on the page but limited to the first 20 search results. When the user scrolls the page and hits the bottom of the page a further 20 results are loaded and displayed. I have implemented a voting system so the these particular tweets can be voted up and down. However when the scro...

Load random CSS on page refresh

I was wondering whats the best way to call a random css file on page refresh with Javascript? Many thanks ...

jQuery .hover() only working in FireFox

I need to add informational popups to several menu items, and Im using jQuery .hover to do so. However this only works in Firefox and does not work in Safari, Chrome or Opera. var Main = function() { //other functions... function _setPopups() { $(".dt_event_title a").hover( function(){ $(".i...

Switching jQuery UI tabs lose scrollposition in IE

The issue is not happening in Firefox, but the userbase is completely on IE. On the below page, there is a mock-up of three tabs, with their height set to a value and an overflow of auto. When you scroll to a certain position in the Tab One and switch to any other and come back, the scroll position is lost in IE (have tested only with I...

jQuery: Can content loaded via ajax update the DOM?

I have a list of posts that is loaded onto my page using ajax like so: var fm = <?php echo $from_user ;?>; $("#microblogposts").load("posts.php", {from_user: fm}, function(){ }); Within this list of posts I have a function to delete posts from the list: //START POST DELETE FUNCTION $("form#deletepost").submit(function() { /...

jQuery FancyBox/Lightbox problem

Hi all, i write some html with JS into a div. like this $("#picdiv").html("<a rel='lightbox' href='pic.jpg'><img src='htumb.jpg'></a>"); it is just an example. So, i have in $(document).ready Funcktion this code. $('a[rel=lightbox]').fancybox(); but if i click on the link, a get to the page with picture... i know the Problem m...

jquery/js: OnFocus OnBlur ?

Hey, i wish to make an ajax call if it has lost the focus from my site for 1 minute, so when it's onfocus again it send an ajax call? How can i do that? ...

How are web developers accommodating former onmouseover or tooltip functionality in touch interfaces?

Possible Duplicates: Tooltips in the era of touch UX Design for Disabled Controls w/ the Touch Interface I've long been in debt to the wonderful wz_tooltip javascript library, binding mouseover events to tooltips in order to offer contextual information. However with touch interfaces on the rise, I am now looking for a bett...

Should I learn ASP.NET AJAX, jQuery or both?

I'm .NET developer. Most of my career I worked on web based intranet applications (ASP.NET WebForms) but always as a server side developer. Client side development was done by my colleagues more skilled in JavaScript and different JS frameworks. At the moment I have some JavaScript skills and very elementary understanding of both ASP.NET...

Only one ajax call, wait until success until next click

How do prevent like if a user clicks alot of times on a link that runs a ajax call, that it only run again after the it has been succeed ...

How to make jQuery post data to Controller and then return to another view page

I'm working on a MVC project and I use jQuery to post data from my Index page to Home controller from view page function Search(){ var _name = document.getElementById("HotelName").value; $.post("Search/", { name: _name }); } In my controller public ActionResult Search(String name){ var Hotel = db.getHotelByName(name); retu...

jQuery .html with variable

Hi. Currently I'm using Wordpress & creating my own metabox in the write post panel. I've got a script that adds a custom media upload button. When the user clicks 'insert into post' it inserts the image URL into a text box. However, I also want to display a live preview of this image & I would like the script to insert the URL also into...