[jQuery] Re: looping through form elements.
Well if you just want the element, you don't even need the :. Just $ ('input') would do the trick. Greetz, Rick On Jan 8, 9:35 pm, rich dottedq...@gmail.com wrote: Rick, Thank you for your response. I was able to figure out $ (this).val() grabbed the value and you explained $(this).attr should do the trick with grabbing what type the input element is. I appreciate your help. I had to change .input to :input since I'm filtering out by the element not by a class named input. -Thanks, Rich On Jan 8, 7:11 am, Rick van Hoeij rickvho...@gmail.com wrote: Hey, Maby this will help: $('.input').each(function(){ alert('Value: ' + $(this).val() + ' - Type: ' + $(this).attr ('type')); }); That should do the trick. Just let me know. Greetz, Rick On Jan 7, 11:33 pm, rich dottedq...@gmail.com wrote: Hello all, I'm relatively new to JavaScript. I would like to loop through all the elements within a form and grab their values and what type of input they are. So far I came up with: $(':input').each(function(idx, item) { alert(idx); }); The alert is placed there to see if it loops and it works as expected. I'm not sure how to alert the input's value and what type it is. Any help is greatly appreciated. -Thanks, Rich
[jQuery] Re: how to do some animation when the page loads?
Hey Oliur, You could just do that after the document ready: $(document).ready(function(){ $(.divname).animate({ opacity: 0.5, }, 300 ); }); That should do the trick, I think. Greetz, Rick On Jan 9, 2:53 pm, Oliur o.r.chowdh...@gmail.com wrote: when the DOM is ready you can write $(document).ready(function(){ $(#divname).hide(); }); Say now, you want to try and do some animation done by default, (in the below example I have done some animation only when the user do mouse over, how can i do that by default as in when the page loads) $(document).ready(function(){ $(.divname).mouseover(function(){ $(.divname).animate({ opacity: 0.5, }, 300 ); }); });
[jQuery] Re: looping through form elements.
Hey, Maby this will help: $('.input').each(function(){ alert('Value: ' + $(this).val() + ' - Type: ' + $(this).attr ('type')); }); That should do the trick. Just let me know. Greetz, Rick On Jan 7, 11:33 pm, rich dottedq...@gmail.com wrote: Hello all, I'm relatively new to JavaScript. I would like to loop through all the elements within a form and grab their values and what type of input they are. So far I came up with: $(':input').each(function(idx, item) { alert(idx); }); The alert is placed there to see if it loops and it works as expected. I'm not sure how to alert the input's value and what type it is. Any help is greatly appreciated. -Thanks, Rich
[jQuery] Re: Getting Div to Show after mouseout
Hey, I would add another class to the div you want to show. That way you can keep it selected until you go over another div. Like this: $(a.mSelect).hover( function () { $('.selected').each(function(){ $(this).hide(); }); var month = $(this).attr(rel); $(#m + month).addClass('selected'); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] Re: Getting Div to Show after mouseout
Hey, I would add another class to the div you want to show. That way you can keep it selected until you go over another div. Like this: $(a.mSelect).hover( function () { $('.selected').each(function(){ $(this).removeClass('selected'); $(this).hide(); }); var month = $(this).attr(rel); $(#m + month).addClass('selected'); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); Something like that. Hope this helps. Greetz, Rick On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: - Hide quoted text - - Show quoted text - $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks! ReplyReply to authorForward You must Sign in before you can post messages. To post a message you must first join this group. Please update your nickname on the subscription settings page before posting. You do not have the permission required to post. On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] Re: Getting Div to Show after mouseout
Hey, I would add another class to the div you want to show. That way you can keep it selected until you go over another div. Like this: $(a.mSelect).hover( function () { $('.selected').each(function(){ $(this).removeClass('selected'); $(this).hide(); }); var month = $(this).attr(rel); $(#m + month).addClass('selected'); $(#m + month).fadeIn(); }, function () {} ); Something like that. Hope this helps. Greetz, Rick On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] Re: jquery text problem.
I usually use this code: $('#textbox_id').val() But I don't know id it is different in .net Hope this helps. Greetz, Rick On Dec 19, 11:48 am, suresh kumar ksuresh...@gmail.com wrote: I am using jquery block to show the popup window. In which the popup has two textboxes with two buttons. When user clicking the buttion i need to get the value from two textboxe's and save it to the database. But when i try to get the value it is nulll or empty string. How can i get the textbox value in code behind file ? ( .net ) Thanks, Suresh.
[jQuery] Re: jQuery attaching actions to links with different class
I would use: $('a').click(function(){ var car_id = parseFloat($(this).attr('class')); $('#' + car_id).show(); }); Haven't tested this, but should work if I read your description right. Greetz, Rick On Dec 18, 1:57 pm, imot3k r.imp...@gmail.com wrote: Hi, I'm making a website for a garage. In the cars section I generate the cars list thru PHP. In the table there is a link to the details of the car. There is also a picture which can be clicked to go the details. So it would look something like this: td rowspan=3 width=13\a class=info6 href=#img src=../ website_patrick/images/6.jpg width=114 height=77 border=0 alt= //a/td td colspan=4 class=more_infoa class=info6 href=#more info/ a/td I've given a class to each of the links. The class name = info + car_id. Then I also have a div which has an id equal to the car_id and which is hidden. Now when you click either the picture or regular link the div should be displayed. How can i achieve this? Thanks in advance
[jQuery] Re: Return values
because of the async of javascript I normally use callback functions to do the value passing. So instead of return true or return false in a ajax function, it's better to call a function with the true or false as a parameter. Just my two cents ;) On 12 dec, 20:24, Jojje jojjsus_chr...@hotmail.com wrote: How deep in the scope can you go in nested functions and still return a value? For example: $.validator.addMethod('userCheck', function (value) { $.ajax({ type: POST, url: _scripts/send_message.php, data: action=checkuser username= + value, success: function(msg) { if (msg) { return false; } else { return true; } } }); },); Why is´nt this working? If i do this: //Global var result; $.validator.addMethod('userCheck', function (value) { $.ajax({ type: POST, url: _scripts/send_message.php, data: action=checkuser username= + value, success: function(msg) { if (msg) { result = false; } else { result = true; } } }); return result; },); i get the value back but it does not work properly, It gets the value from the textfield but on keyup it's always one letter short... so i have to type one more letter to get the right value. I´m stuck on this so any help would be greatly appreciated! :) Thanks in advance George
[jQuery] Re: add element after page has loaded
Hey, Best way to make sure that the form has been loaded is to use the load callback function: $('#formGen1').load('formGen1.jsp', function(){ //Callback function: Form has been loaded //Code implementation }); I usualy hide the form that I'm editing until it is ready to be shown. Simple hide() and show(). Hope this helps. Greetz, Rick On 26 nov, 01:25, edencane edenc...@gmail.com wrote: Hi. I have the following document.ready: $(document).ready(function(){ $('#formGen1').load('formGen1.jsp'); if(${membership eq 'propertyContractor'}) { $('#formGen2').load('formGen2.jsp'); $('#formGen3a').load('formGen3a.jsp'); } else if (${membership eq 'cleaningContractor'}) { $('#formGen2').load('formGen2.jsp'); $('#formGen3a').load('formGen3b.jsp'); $('#formGen3b').load('formGen4.jsp'); $('#formGen4').load('formGen3a.jsp'); } else if (${membership eq 'staff'}) { $('#formGen2').load('formGen3a.jsp'); } $(window).load(function () { alert($('#dob').prev().html()); //run code }); }); the html loaded in 'formGen1' is: fieldset legendPersonal details/legend plabel for=nameName/label input class=required type=text id=name name=name/ span/span/p plabel for=dobDate of birth/label input type=text class=expanddate id=dob name=dob value= format=date span/span/p /fieldset What I want to do is add an element after the #dob element. In the 's$(window).load' statement I am showing the html of the previous element as some feedback... As I understand it, $(window).load should kick in after all the pages have loaded, but clearly in my case something else is going on... i.e. the pages havent loaded yet... How can I do this? Thanks. Kind regards. Luke.
[jQuery] Re: Is mouse inside a div?
Hey, If you are referring to hovering your mouse over a div there is the hover event: $('#divid').hover(function(){ // Implement code while mouse is hovering div },function(){ // Implement code while mouse leaves div }); There are different mouse events too. Check them out at: http://docs.jquery.com/Events Hope this helps. Greetz, Rick
[jQuery] Re: Is mouse inside a div?
Hey, Don't know if you mean when you hover over a div? Cause then you should just use the hover event: $('#divid').hover(function(){} //Implement code while hovering ,function(){ // Implement code when you exit the div }); Hope this helps. Greetz, Rick