How do you set the cursor position in a text field using jQuery? I've got a text field with content, and I want the users cursor to be positioned at a certain offset when they focus on the field. The code should look kind of like this:
$('#input').focus(function() {
$(this).setCursorPosition(4);
});
What would the implementation o...
I have a drop down list with known values. What I'm trying to do is set the drop down list to a particular value that I know exists using jQuery. Using regular JavaScript, I would do something like:
ddl = document.getElementById("ID of element goes here");
ddl.value = 2; // 2 being the value I want to set it to.
However, I need to d...
Everyone probably notices that most modern applications nowadays has a way for user to send crash/bug report either automatically or with user permission. Some examples are Mozilla Crash Reporter or most Microsoft applications.
I really like this feature since it allows me to collect the bugs report quickly with helpful information tha...
hi,
I have an input box, and I have bound both blur and keypress events to the input. but the problem is when there is a keypress event blur event also fires. Is there any way to suppress blur event when keypress event occurs?
thanks
...
I have a jQuery selector, which has a chained function.
Inside the function I want to get access to the TEXT representing the expression for the selector.
$("cat dog").function() {
// how do I get access to the "cat dog" string from inside THIS function ?
};
I've over simplified in this code sample what I actually want to do. I'...
I'm novice with both JS and jQuery, and I'm a little bit confused about what situations would require you to pass event as an argument into the function, and what situations you would not need to.
For example:
$(document).ready(function() {
$('#foo').click(function() {
// Do something
});
});
versus
...
Hi,
I have done the following code in JavaScript to put focus on the particular element (branch1 is a element),
document.location.href="#branch1";
But as I am also using jQuery in my web app, so I want to do the above code in jQuery. I have tried but don't know why its not working,
$("#branch1").focus();
The above jquery (focus()...
I am building a asp.net webforms (3.5 sp1) application, using jquery where I can to animate the UI, change its state. It has worked great until I started doing postbacks, where the UI obviously resets itself to its initial state.
So my question is, what are the best practices for saving and restoring jquery/UI state between postbacks?
...
I have a drop down menu and it works perfectly on everything except IE6 & IE7.
Here it is in the Safari/Firefox browsers: http://tinyurl.com/at2cb4
Here is how it looks in IE6 & IE7: http://tinyurl.com/beop5l
Here is the CSS for the div where it hides underneath for IE 6/7
#featured-programs-left img,
#featured-programs-right img{
...
Thanks for reading this.
I would have thought it would be as simple as using the .split function on the select .val(), but I get a js error. This is the code I am using. I will use .each() to loop through the selected items...but would like to understand what I am doing wrong...
If I set opts with a literal..the split works (commented ...
Hello Everyone,
I want to use the jQuery accordion tool for a form i'm building so I used some sample code from the jquery website but it doesn't work at all!
The javascript does nothing at all so you just get the html rendered. I am using version 1.3.1 of jquery with version 1.6rc6 of jquery-ui.
<head runat="server">
<script src...
Given the following code,the hover function works correctly, but when clicked, loses the clicked_no_event_box class. Not sure where I'm going wrong...
/* On document.ready.. */ $(function(){
$(".no_event_box").hover(
function(){$(this).addClass("clicked_no_event_box");},
function(){$(this).removeClass("clicke...
I'm building a site using ASP.NET MVC with lots of jQuery and AJAX stuff, and I'd like the main menu to work with AJAX as more or less the rest of the site does.
In an ideal scenario, I would like my main menu to
1) load the main content with AJAX if the user has activated javascript
2) change the url in the address bar (to enable link...
I use a datepicker for choosing an appointment day. I already set the date range to be only for the next month. That works fine. I want to exclude Saturdays and Sundays from the available choices. Can this be done? If so, how?
...
Is it possible to show calendar as shown below using jquery datepicker.
OCT-2009
Mon Tue Wed Thur Fri Sat Sun
28 29 30 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 ...
Hi,
I am relatively new to jquery and web development.
I am using jquery tabs to create tabs.
But i want the contents to be loaded only when i select a particular tab.
Can someone please help me with this?
...
Dear all
I am using Mootools 1.11 and Jquery 1.2,
ajax function not work properly for following code
jQuery(document).ready(function($) {
confirm("Hello");
function confirm(message){
$.ajax({
url: 'ajax.php',
....
}); ...
How can I redirect the user from one page to another using jQuery?
...
I'm trying to execute a asp.net webservice using jquery. When I pass only one input parameter it works fine:
$.ajax({
type: "POST",
url: url,
data: "{'Id1':'2'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: callback
});
but if I try to pass multiple parameters it fails
...
I want to trigger a hyperlink by hitting Enter using jQuery. I have the following html but all an Enter-stroke does is trigger the alert, it doesn't navigate to the link. Clicking the link, however, does navigate to the new address. What am I missing?
I know my test function is working since the addClass/removeClass functions are workin...