Search Results

Search found 23364 results on 935 pages for 'jquery ui droppable'.

Page 111/935 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • Prevent Jquery Accordion tab from expanding

    - by Edwin
    I'm trying to use JQuery UI Accordion as a menu, but I can't figure out how to prevent some tabs from expanding. My JS: $("#sidebar").accordion({ collapsible: true, changestart: function(event, ui) { switch ($(ui.newHeader).attr("id")) { case "sidebar_grades": return false; break; } } }); the HTML: <div id="sidebar"> <h3 id="sidebar_home"> <a href="/blah">Home</a> </h3> <div> <a href="/child">Settings</a> </div> <h3 id="sidebar_grades"> <a href="/grades">Grades</a> </h3> <div></div> <h3 id="sidebar_calendar"> <a href="/calendar">Calendar</a> </h3> <div></div> </div> In the above example, since #sidebar_grades doesn't have any child, it should not be expandable, but user can click on the link. I tried using "changestart" event and return false when #sidebar_grades is clicked, but it doesn't work. I also tried attaching onClick event to #sidebar_grades to return false, but that didn't work either. Any idea how to do this? Thank you!

    Read the article

  • Password Confirmation Overlay

    - by Alasdair
    Hello, I'm creating a J2EE web application that uses jQuery and Ajax to help with some of the presentation for a user-friendly interface. I've done a lot of work ensuring security around persistant login cookies, and I've decided to request the password from any user that logged in using a persistant login cookie before being allowed to make any changes that could be malicious. This request would only happen once to confirm the user is who they say they are and will last throughout the session. At present, any requests that meet this criteria has their request information stored in session and then the user is forwarded to a page to confirm their password. Once confirmed, the user's original request is then performed and the requestion information removed from session. What I would like to do is avoid all this redirection and minimize what's held in session (even if it's just for a small time), thus improving usability and convenience for the user. I believe that a jQuery overlay could allow me to prompt the user for their password (if required) and then continue to submit the request if successful. I would of originally used ThickBox, but since that's now deprecated I don't see the benefit in implementing it in an application at this development stage. However, I have tried to create an overlay using jQuery but I've scrapped every attempt as I can't seem to make it all come together. My main problem is preventing the submission when the user incorrectly types a password or cancels the overlay. Desired Flow Persistant Login Sensitive Page Submit Password Confirmation Overlay [Continue Submit | (Cancel | Incorrect] I have already created JavaScript code to encrypt the password to be sent in a parameter, but all I need now is a method of controlling the overlay and how best to use Ajax for this purpose. Please ignore the fact that this is a J2EE web application when answering as it is irrelevant really. Thanks in advance, Alasdair

    Read the article

  • jCarousel - achieving an active state AND wrap:circular

    - by swisstony
    Hey folks A while back I implemented the jCarousel image solution for a client that required a numbered active state. After a bit of googling a found the answer but noticed that the preferred circular option would not work. What would happen is that once the carousel had cycled through all its (5) images, upon the return to the first, the active state would be lost, because, according to jcarousel it was actually the 6th (the index just keeps on incrementing). I just went ahead and instead used wrap:'both' which at least had a correctly functioning active state. However now the client says they dont like this effect and simply want the animation to return to position 1 after the final image. This means I need to get'wrap: 'both' working somehow. Below is my current code. Can someone please solve this one, as its a little above my head! function highlight(carousel, obejctli,liindex,listate){ jQuery('.jcarousel-control a:nth-child('+ liindex +')').attr("class","active"); }; function removehighlight(carousel, obejctli,liindex,listate){ jQuery('.jcarousel-control a:nth-child('+ liindex +')').removeAttr("class","active"); }; jQuery('#mycarousel').jcarousel({ initCallback: mycarousel_initCallback, auto: 5, wrap: 'both', vertical: true, scroll: 1, buttonNextHTML: null, buttonPrevHTML: null, animation: 1000, itemVisibleInCallback: highlight, itemVisibleOutCallback: removehighlight }); }); Thanks in advance

    Read the article

  • Selecting a form which is in an iframe using jQuery

    - by Khnle
    I have a form inside an iframe which is inside a jQuery UI dialog box. The form contains a file input type. The jQuery UI dialog contains an Upload button. When this button is clicked, I would like to programmatically call the submit method. My question is how I could select the form which is in a iframe using jQuery. The following code should clarify the picture: <div id="upload_file_picker_dlg" title="Upload file"> <iframe id="upload_file_iframe" src="/frame_src_url" frameborder=0 width=100% scrolling=no></iframe> </div> frame_src_url contains: <form action="/UploadTaxTable" enctype="multipart/form-data" method="post" id="upload-form"> <p>Select a file to be uploaded:</p> <p> <input type="file" name="datafile" size="60"> </p> The jQueryUI dialog box javascript code: $('#upload_file_picker_dlg').dialog({ ... buttons: { 'Close': function() { $(this).dialog('close'); }, 'Upload': function() { $('#upload-form').submit(); //question is related to this line $(this).dialog('close'); } }, .... }); From the javascript code snippet above, how can I select the form with id upload-form that is in the iframe whose id is upload_file_iframe ?

    Read the article

  • Animate absolutely positioned div, but stop if a condition is true?

    - by Alex
    Hello all, I have a div which I place at the top right-hand corner of a website, absolutely positioned at top: 0px and right : 0px. I want to use jquery's animate function to animate the div left or right a certain amount when a button is clicked, but stop the animation if at anytime, the div's offset to the left or right is less than a certain number. I want to do this to accomodate users who click the left or right buttons more than once, so that the div does not fly out of sight. How does one accomplish this? Below is my relevant css, html, and jquery code: CSS: #scorecardTwo { position:absolute; padding:5px; width: 300px; background-color:#E1E1E1; right:0px; top:0px; display:none; } HTML: <div id = "scorecardTwo"> <span id = "dealHolder"><a href="some/link">some text</a></span> <br /> <span id = "scoreHolder">some text</span> <br /> <button type="button" id="moveLeft">Left</button>&nbsp;<button type="button" id="moveRight">Right</button> </div> jQuery (at the moment): $("#scorecardTwo").fadeIn("slow"); $("#moveLeft").bind("click", function() { $("#scorecardTwo").animate({"right":"+=76%"}, "slow"); // how to stop animation if offset is less than appropriate number? }); $("#moveRight").bind("click", function() { $("#scorecardTwo").animate({"right" : "-=76%"}, "slow"); // how to stop animation if offset is less than appropriate number? });

    Read the article

  • How To Select First Ancestor That Matches A Selector?

    - by Zach
    General: How can I select the first matching ancestor of an element in jQuery? Example: Take this HTML block <table> <tbody> <tr> <td> <a href="#" class="remove">Remove</a> </td> </tr> <tr> <td> <a href="#" class="remove">Remove</a> </td> </tr> </tbody> </table> I can remove a row in the table by clicking "Remove" using this jQuery code: $('.remove').click(function(){ $(this).parent().parent().hide(); return false; }); This works, but it's pretty fragile. If someone puts the <a> into a <div>, for example, it would break. Is there a selector syntax in jQuery that follows this logic: "Here's an element, now find the closest ancestor that matches some selection criteria and return it" Thanks

    Read the article

  • Enable/disable virtual keyboard

    - by dr.Xis
    I'm using a virtual keyboard. I have a checkbox that controls whether the virtual keyboard is displayed or not. The thing is that I don't understand how to disable it. I try to unbind it but it doesn't work... I also tried to use namespaces and then unbind all namespaces but still the keyboard remains accessible after a click on the text box. <input class="virtualKeyboardField ui-keyboard-input ui-widget-content ui-corner-all" data-val="true" data-val-required="The User name field is required." id="loginUserName" name="UserName" type="text" value="" aria-haspopup="true" role="textbox"> <script type="text/javascript"> $(function () { //show login $("#showLogin").on({ click: function () { $("#loginFormDiv").toggle("slow"); } }); $("#cb_showVKey").on('click', CheckIsToShowKey); }); function CheckIsToShowKey(event) { //var isCheck = $("#cb_showVKey").is(':checked'); //alert("ischecked? " + isCheck); if ($("#cb_showVKey").is(':checked')) { //if checked BindKeyboards(); } else { //not checked UnBindKeyboards(); } } function bindVirtualKeyboards() { $("#loginForm").delegate(".virtualKeyboardField", "click.xpto", BindKeyboards); } function UnBindKeyboards() { $("#loginForm").undelegate(".virtualKeyboardField", "click.xpto", BindKeyboards); } function BindKeyboards() { // alert(event.currentTarget.id); //alert("xpto"); if ($("#cb_showVKey").is(':checked')) { $("#loginUserName").keyboard({ layout: 'qwerty', lockInput: true, preventPaste: true }); $("#loginUserPassword").keyboard({ layout: 'qwerty', lockInput: true, preventPaste: true }); } } $(document).ready(function () { $("#loginForm").validate(); BindKeyboards(); }); </script> Any help guys?

    Read the article

  • ASP.NET MVC 3 Client-Side Validation Summary with jQuery Validation (Unobtrusive JavaScript)

    - by Soe Tun
    When we were working with ASP.NET MVC 2, we needed to write our own JavaScript to get Client-Side Validation Summary with jQuery Validation plugin. I am one of those unfortunate people still stuck with .NET Framework Runtime 2.0 and .NET Framework 3.5; meaning I am still on ASP.NET MVC 2. So I will still keep on supporting by answering any question you may have with my original code.   Long awaited ASP.NET MVC 3 has been released, and it supports Client Side Validation Summary with jQuery out-of-the-box with new features like Unobtrusive JavaScript.   1. _Layout.cshtml Template Notice that I am using Protocol Relative URLs ( i.e., '//'.  Not 'http://' or 'https://' ) to reference script files and css files and you should use it too like that! However, please note that IE7 and IE8 will download the CSS files twice so use it with judgement. <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Assets/Site.css")" rel="stylesheet" type="text/css" /> <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> @RenderBody() <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> <script src="//ajax.microsoft.com/ajax/jQuery.Validate/1.7/jQuery.Validate.min.js" type="text/javascript"></script> <script src="//ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js" type="text/javascript"></script> </body> </html>   2. MVC View Template There are 3 things you *must* do exactly to get Client Side Validation Summary working. (1)  You must declare your Validation Summary **inside** the `Html.BeginForm()` block like below. (2)  You must pass `excludePropertyErrors: false` to the  Html.ValidationSummary()  method. @using (Html.BeginForm()) { @Html.ValidationSummary(false, "Please fix these errors."); <!-- The rest of your View Template --> }   (3)  You have to put the following two elements in the `<appSettings />` block of your Web.config file. <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/>   That is all you need to do.  Simple, right? I will upload a sample project for download soon.  Please let me know if you run into some issues.     P.S: Without getting into too much technical details, I just wanted to let you know what I went through to get this to work. I had to look into the ASP.NET MVC 3 RTM Source Code and the jquery.validate.unobtrusive.js source. Initially, I thought I have to hack the jquery.validate.unobtrusive.js or something to get this to work. But after digging into MVC3 RTM source, I found out how to do it.

    Read the article

  • Control third check box based on the state of the first two using jquery

    - by Moj
    I have three check boxes and need to disable the third if either and/or of the other two are checked. I'm sure there's a easier way than what I have currently. It's turning into what I believe is a mess and I'm hoping that someone with more jquery knowledge can shine the light here. Here's my simple html form: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script src="custom.js" type="text/javascript"></script> </head> <body> <input type="checkbox" class="class" id="1">First <input type="checkbox" class="class" id="2">Second <input type="checkbox" class="class" id="3">Third </body> </html> Here's the javascript I'm using with jquery v1.4.2 jQuery(document).ready(function() { // watches the events of all checkboxes $(":checkbox").click(function(){ if( // if both 1 and 2 are checked we don't want to enable Third until both are unchecked. (($('#1:checkbox').attr('checked'))&&($('#2:checkbox').attr('checked')))|| ((($('#1:checkbox').attr('checked'))&&($('#2:checkbox').attr('checked')))&&($('#3:checkbox').attr('disabled')))|| ((($('#1:checkbox').attr('checked'))||($('#2:checkbox').attr('checked')))&&($('#3:checkbox').attr('disabled'))) ){ // we don't want to do anything in the above events } else if( // handles the First check box (($('#1:checkbox').attr('checked'))||(!$('#1:checkbox').attr('checked')))|| // handles the Second check box (($('#2:checkbox').attr('checked'))||(!$('#2:checkbox').attr('checked'))) ){ // call the disableThird function disableThird(); } }); // handles enabling and disabling the Third checkbox function disableThird(){ var $checkbox = $('#3:checkbox'); $checkbox.attr('disabled', !$checkbox.attr('disabled')); }; }); For some reason checking #3 will disable it's self. I don't understand why. This works, but one of the requirements is that a non programmer should be able to edit and maintain this. Ideally it'd be great if he could just add new check boxes to the html and it would work. The class for these are define and as far as I know can't be changed. The last check box in the list of check boxes will disable if any of the ones above are selected. Like wise if the last check box is selected, it will disable all the ones above it. I haven't even begun writing and testing that portion as this is quickly becoming too complicated for a non programmer to handle. I myself am more of a PHP coder than a js, let alone jquery, coder. Any help would be greatly appreciated.

    Read the article

  • asp.net with jquery valduation issue

    - by Eyla
    Greetings, I have 2 textboxs, 2 checkboxs and 2 labels. first textbox, checkbox, and label related to each other and the same for the rest. textbox should accept valid phone number based on jquery validation plugin and when the chackbox check the validation rule would change and in both option the error message would disply inside the label. I have no problem to implement that for one text box but when I add second one will have a problem and only the validation will happen for the second one only. please look at my code and advice. <script src="js/jquery-1.4.1.js" type="text/javascript"></script> <script src="js/jquery.validate.js" type="text/javascript"></script> <script type="text/javascript"> var RegularExpression; var USAPhone = /^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$/; var InterPhone = /^\d{9,12}$/; var errmsg; function ValidPhoneHome(sender) { if (sender.checked == true) { RegularExpression = InterPhone; errmsg = "Enter 9 to 12 numbers as international number"; } else { RegularExpression = USAPhone; errmsg = "Enter a valid number"; } jQuery.validator.addMethod("phonehome", function(value, element) { return this.optional(element) || RegularExpression.test(value); }, errmsg); } function ValidMobileHome(sender) { if (sender.checked == true) { RegularExpression = InterPhone; errmsg = "Enter 9 to 12 numbers as international number"; } else { RegularExpression = USAPhone; errmsg = "Enter a valid number"; } jQuery.validator.addMethod("mobilephone", function(value, element) { return this.optional(element) || RegularExpression.test(value); }, errmsg); } $(document).ready(function() { ValidPhoneHome("#<%= chkIntphoneHome%>"); ValidMobileHome("#<%= chkIntMobileHome%>"); $("#aspnetForm").validate({ rules: { "<%=txtHomePhone.UniqueID %>": { phonehome: true } } , errorLabelContainer: "#lblHomePhone", rules: { "<%=txtMobileHome.UniqueID %>": { mobilephone: true } } , errorLabelContainer: "#lblMobileHome" }) </script> <asp:CheckBox ID="chkIntphoneHome" runat="server" Text="Internation Code" onclick="ValidPhoneHome(this)" > <asp:TextBox ID="txtHomePhone" runat="server" ></asp:TextBox> <label id="lblHomePhone"></label> <asp:CheckBox ID="chkIntMobileHome" runat="server" Text="Internation Code" onclick="ValidMobileHome(this)" /> <asp:TextBox ID="txtMobileHome" runat="server"></asp:TextBox> <label id="lblMobileHome"></label>

    Read the article

  • jquery selector problem with script tags

    - by Tauren
    I'm attempting to select all <script type="text/html"> tags in a page. I use <script> tags to store HTML templates, similar to how John Resig does it. For some reason, the following jquery selector doesn't seem to be selecting anything: $("script[type*=html]").each(function() { alert("Found script "+this.id); }); This markup is in the BODY of the HTML document: <body> <script id="filter-search" type="text/html"> <dt>Search</dt> <dd><input type="text"/></dd> </script> </body> I've also tried putting it into the HEAD of the HTML document, and it is still not found. No alert is ever shown. If I instead change my code to this: $("script[type*=javascript]").each(function() { alert("Found script "+this.id); }); Then it finds only the scripts in the HEAD that have a src to an external file. Scripts in the actual page are not found. For instance, with the following in HEAD: <head> <script type="text/javascript" src="jquery.js" id="jquery"></script> <script type="text/javascript" src="jquery-ui.js" id="ui"></script> <script type="text/javascript" id="custom"> $(document).ready( function() { $("script[type*=javascript]").each(function() { alert("Found script "+this.id); }); $("script[type*=html]").each(function() { alert("Found TEMPLATE script "+this.id); }); }); </script> <script id="filter-test" type="text/html"> <dt>Test</dt> </script> </head> <body> <script id="filter-search" type="text/html"> <dt>Search</dt> <dd><input type="text"/></dd> </script> </body> I get the following alerts: Found script jquery Found script ui The custom and filter-test scripts in the HEAD are not selected, nor is the filter-search script in the body tag. Is this the expected behavior? Why does this not work? I can work around it, but it is annoying that it doesn't work.

    Read the article

  • How to auto apply drag and drop effect to dynamically added element ?

    - by Relax
    I use jquery ui to apply a drag and drop effect on a serial of DIVs, for example: <div class="draggable">...</div> <div class="draggable">...</div> <div class="draggable">...</div> <div class="draggable"> this DIV was dynamically added, not draggable </div> The problem is dynamically added DIVs won't have this effect applied, how can i apply this effect on new members too?

    Read the article

  • JQuery and PHP display problem

    - by TheCREATOR
    I'm new to JQuery but for some reason I cant get the php code to display correctly when I put it in my JQuery script. The php code will display correctly when its not in the JQuery code can someone help me fix my JQuery code so it will display my PHP code correctly? Here is the JQuery and PHP code. var count = 0; $(function(){ $('p#add_field').click(function(){ count += 1; $('#container').append( '<input type="text" name="sk" id="sk" />' + '<label for="exp">Exp: </label>' + '<?php' + 'echo \'<select id="exp" name="exp">\' . "\n";' + 'foreach($options as $option) {' + 'if ($option == $exp) {' + 'echo \'<option value="\' . stripslashes(htmlentities(strip_tags($option))) . \'" selected="selected">\' .' + ' stripslashes(htmlentities(strip_tags($option))) . \'</option>\' . "\n";' + '} else {' + 'echo \'<option value="\'. stripslashes(htmlentities(strip_tags($option))) . \'">\' .' + 'stripslashes(htmlentities(strip_tags($option))) . \'</option>\'."\n";' + '}' + '}' + 'echo \'</select>\';' + '?>' + '<label for="g">RGB: </label>' + '<?php' + 'echo \'<select id="g" name="g">\' . "\n";' + 'foreach($options as $option) {' + 'if ($option == $g) {' + 'echo \'<option value="\' . stripslashes(htmlentities(strip_tags($option))) . \'" selected="selected">\' .' + 'stripslashes(htmlentities(strip_tags($option))) . \'</option>\' . "\n";' + '} else {' + 'echo \'<option value="\'. stripslashes(htmlentities(strip_tags($option))) . \'">\' .' + 'stripslashes(htmlentities(strip_tags($option))) . \'</option>\'."\n";' + '}' + '}' + 'echo \'</select>\';' + '?></li>' ); }); });

    Read the article

  • jQuery jScrollPane - it simply won't work! :'(

    - by Jack Webb-Heller
    Hey folks, OK - I'll admit, I'm quite a beginner in this jQuery-department. I've probably made some amateur mistake, but hey, you gotta learn somewhere! :) So I'm using jScrollPane: http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html I want to use it style the scrollable area in my second column. Specifically, I would like to apply and format the scrollbars on the div #ajaxresults My page is... rather jQuery heavy. I don't know if any variables are conflicting or something... in fact I really have no idea at all why this isn't working. Take a look at my problematic page: http://furnace.howcode.com In the header, I've set this to go: <!-- Includes for jScrollPane --> <script type="text/javascript" src="http://localhost:8888/js/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="http://localhost:8888/js/jScrollPane.js"></script> <link rel="stylesheet" type="text/css" media="all" href="http://localhost:8888/stylesheets/jScrollPane.css" /> <script type="text/javascript"> $(function() { $('#ajaxresults').jScrollPane(); }); </script> (I've changed localhost on the server copy though) Nothing ever seems to work with the #ajaxresults div. I've set, as the jScrollPane docs say, overflow:auto on it but still no luck. I find that when jScrollPane DOES seem to 'run' it just moves the div down about 100 pixels. Try it for yourself. Perhaps someone could help? There's quite a few jQuery plugins there so I don't know if something's colliding/crashing etc... Please note the site is still in development between myself and a friend, which explains the personal messages we submit to each other ('Hi Donnie!' etc. :D ). Also, when you view the page nothing may appear in the second column for a few seconds - it's just fetching the data via Ajax. So give it a little time. Thanks very much! Jack

    Read the article

  • Problem with jQuery.ajax with 'delete' method in ie

    - by Max Williams
    I have a page where the user can edit various content using buttons and selects that trigger ajax calls. In particular, one action causes a url to be called remotely, with some data and a 'put' request, which (as i'm using a restful rails backend) triggers my update action. I also have a delete button which calls the same url but with a 'delete' request. The 'update' ajax call works in all browsers but the 'delete' one doesn't work in IE. I've got a vague memory of encountering something like this before...can anyone shed any light? here's my ajax calls: //update action - works in all browsers jQuery.ajax({ async:true, data:data, dataType:'script', type:'put', url:"/quizzes/"+quizId+"/quiz_questions/"+quizQuestionId, success: function(msg){ initializeQuizQuestions(); setPublishButtonStatus(); } }); //delete action - fails in ie function deleteQuizQuestion(quizQuestionId, quizId){ //send ajax call to back end to change the difficulty of the quiz question //back end will then refresh the relevant parts of the page (progress bars, flashes, quiz status) jQuery.ajax({ async:true, dataType:'script', type:'delete', url:"/quizzes/"+quizId+"/quiz_questions/"+quizQuestionId, success: function(msg){ alert("success"); initializeQuizQuestions(); setSelectStatus(quizQuestionId, true); jQuery("tr[id*='quiz_question_"+quizQuestionId+"']").removeClass('selected'); }, error: function(msg){ alert("error:" + msg); } }); } I put the alerts in success and error in the delete ajax just to see what happens, and the 'error' part of the ajax call is triggered, but WITH NO CALL BEING MADE TO THE BACK END (i know this by watching my back end server logs). So, it fails before it even makes the call. I can't work out why - the 'msg' i get back from the error block is blank. Any ideas anyone? Is this a known problem? I've tested it in ie6 and ie8 and it doesn't work in either. thanks - max EDIT - the solution - thanks to Nick Craver for pointing me in the right direction. Rails (and maybe other frameworks?) has a subterfuge for the unsupported put and delete requests: a post request with the parameter "_method" (note the underscore) set to 'put' or 'delete' will be treated as if the actual request type was that string. So, in my case, i made this change - note the 'data' option': jQuery.ajax({ async:true, data: {"_method":"delete"}, dataType:'script', type:'post', url:"/quizzes/"+quizId+"/quiz_questions/"+quizQuestionId, success: function(msg){ alert("success"); initializeQuizQuestions(); setSelectStatus(quizQuestionId, true); jQuery("tr[id*='quiz_question_"+quizQuestionId+"']").removeClass('selected'); }, error: function(msg){ alert("error:" + msg); } }); } Rails will now treat this as if it were a delete request, preserving the REST system. The reason my PUT example worked was just because in this particular case IE was happy to send a PUT request, but it officially does not support them so it's best to do this for PUT requests as well as DELETE requests.

    Read the article

  • Dynamically adding values to a form with JQuery/Javascript

    - by bigstylee
    I am creating a private message system to allow users to communicate between one another within the context of the website (ie, not emails). I have created this function to handle all my form submissions. I would like to achieve a solution without modifying this function (ideally). $("form.reload").submit(function(){ alert($(this).serialize()); /* Debugging */ $.post($(this).attr("action"), $(this).serialize() ,function(data){ if(data){ $("#error").html(data); }else{ location.reload(); }; }); return false; }); Within my form I am using JQuery Autocomplete to find usernames. This function works perfectly. My first solution was to add buttons within the form with the necessary values. select: function(event, ui) { $("#message_to").append("<input type=\"button\" class=\"recipient\" name=\"recipients[]\" value=\"" + ui.item.label + "\" onclick=\"$(this).remove()\" />"); } <form method="post" action="/messages-create"> <div id="message_to"></div> </div> For some reason the values of recipients are not getting posted. My second solution was to add to a post array that already existed in the form select: function(event, ui) { $(input[name=recipeients[]).val = ui.item.label; /* Need to add to array, not replace! */ $("#message_to").append("<input type=\"button\" class=\"recipient\" name=\"recipient\" value=\"" + ui.item.label + "\" onclick=\"$(this).remove(); /* Remove from recipients */\" />"); } <form method="post" action="/messages-create" class="reload"> <input type="hidden" name="recipients[]" value="" /> <div id="message_to"></div> </div> This works ok, but I have been unable to work out how to append to the recipients[] array only replace with the new label. Moving on from this, I also need to know how to then remove this value from the array. Thanks in advance!

    Read the article

  • Jquery Galleryview

    - by kwek-kwek
    I am working on a site that requires a jquery Galleryview now I have everything set up but my images are not showing. here is my header code: <script type="text/javascript" src="=/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/js/jquery.easing.1.3.js"></script> <script type="text/javascript" src="/js/jquery.timers-1.1.2.js"></script> <script type="text/javascript" src="js/jquery.galleryview-1.1.js"></script> <script> $('#photos').galleryView({ panel_width: 506, panel_height: 275, transition_speed: 1500, transition_interval: 5000, nav_theme: 'dark', border: '1px solid white', pause_on_hover: true }); </script> My gallery code: <div id="photos" class="galleryview"> <div class="panel"> <img src="<?php bloginfo('template_url'); ?>/images/condo-one/1.jpg" alt="image1" /> </div> <div class="panel"> <img src="<?php bloginfo('template_url'); ?>/images/condo-one/2.jpg" alt="image1" /> </div> <div class="panel"> <img src="<?php bloginfo('template_url'); ?>/images/condo-one/3.jpg" alt="image1" /> </div> <div class="panel"> <img src="<?php bloginfo('template_url'); ?>/images/condo-one/4.jpg" /> </div> <div class="panel"> <img src="<?php bloginfo('template_url'); ?>/images/condo-one/5.jpg" /> </div> </div> The problem is that the images are not showing but it's the correct path view the site demo here please help.

    Read the article

  • jQuery 1.4.2 and IE6: change event not firing first time using keyboard

    - by macca1
    I've done a good amount of research on this and found a bunch of reported problems and solutions but the general consensus seems that all change problems in IE6 were fixed in jQuery 1.4.2. I'm having an issue where a change event is not firing in jQuery 1.4.2, but it did fire successfully in jQuery 1.3.2. This is in IE6. I'm about to submit a bug for this, but for my sanity I wanted to post it here first to see if there's something dumb I'm missing. I don't understand why this is working this way... <HTML> <HEAD> <TITLE>jQuery 1.4.2 Problem </TITLE> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> $(document).ready( function() { $("#firstBox").change(function() { alert("CHANGE"); }); // ONLOAD of document autofocus into the first element... $("form").find(":input:visible:first").focus() }); </script> </HEAD> <BODY> <form> <select id="firstBox"> <option value="" selected="selected">--</option> <option value="1">One</option> <option value="2">Two</option> </select> <br><br> <input size="10" id="secondBox"> </form> </BODY> </HTML> Simple enough, right? Onload of the page, give the first element focus. Onchange of the first element, alert. If you use the mouse, it works as expected. The page loads, the focus is in the drop down, you change the option, you get the alert. The problem is if you use the keyboard. The page loads, the focus is in the drop down, you press the down arrow. The option changes. Tab off the field, no alert. Weird. To make it even weirder, if you tab back into the field and change it again (all using the keyboard), the change event DOES fire after tab out this time. Any ideas?

    Read the article

  • Web based weekly planner

    - by Calum
    Hello I'm looking to implement a web based weekly planner where a user can set when they will be unavailable to work. The state of the week will be saved as a 'varbinary' with a length of 168 which will represent every hour of everyday of a week. The database only needs to store the value of one week as the times unavailable to work will be the same each week. I'm looking for a quick and effective method, possibly based on jquery. Thanks

    Read the article

  • JQuery selfbuild plugin question - default value is overwritten.

    - by Bruno
    Hi jQuery ninjas. I need your help. I have made a really clean and simple example to illustrate my problem. I have build my own jquery plugin: (function($) { $.fn.setColorTest = function(options) { options = $.extend($.fn.setColorTest.defaults,options); return this.each(function() { $(this).css({ 'color': options.color}); }); } $.fn.setColorTest.defaults = { color: '#000' }; })(jQuery); As you can see I'm setting a default color and making it possible for the user to change it. My problem/question is: I have two paragraphs on the same page where I want to use the default color for the first and a different color for the second paragraph: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Color Test</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('a#click').click(function() { $('#test1').setColorTest(); }); $('a#click2').click(function() { $('#test2').setColorTest({color: '#fff666'}); }); }); </script> </head> <body> <a id="click">click here</a> <a id="click2">click here2</a> <p id="test1">Test 1</p> <p id="test2">Test 2</p> </body> </html> My problem is that if I click on the second paragraph (p) that overrides the default color and afterwards clicks on the first p it will use the overwritten color and not the default color for the first p. How can I ensure that the first p always will use the default color? I know I can just define the color for the first p as well but that is not an option here $('#test1').setColorTest('color': '#000'); So what to do?

    Read the article

  • Collpasible menu needs all header needs to be closed on initial loading

    - by Maju
    I have a sidebar with collapsible menu it works fine but all the values come expanded the initial loading time.I want it to be closed on load and toggled thereafter. Here is the jquery used // Sidebar Toggle var fluid = { Toggle : function(){ var default_hide = {"grid": true }; $.each( ["pagesnav", "commentsnav", "userssnav", "imagesnav"], function() { var el = $("#" + (this == 'accordon' ? 'accordion-block' : this) ); if (default_hide[this]) { el.hide(); $("[id='toggle-"+this+"']").addClass("hidden"); } $("[id='toggle-"+this+"']") .bind("click", function(e) { if ($(this).hasClass('hidden')){ $(this).removeClass('hidden').addClass('visible'); el.slideDown(); } else { $(this).removeClass('visible').addClass('hidden'); el.slideUp(); } e.preventDefault(); }); } ); } } jQuery(function ($) { if($("[id^='toggle']").length){fluid.Toggle();} }); here is the html <span class="ul-header"><a id="toggle-pagesnav" href="#" class="toggle visible">Content</a></span> <ul id="pagesnav"> <li><a class="icn_manage_pages" href="#">Manage Pages</a></li> <li><a class="icn_add_pages" href="#">Add Pages</a></li> <li><a class="icn_edit_pages" href="#">Edit Pages</a></li> <li><a class="icn_delete_pages" href="#">Delete Pages</a></li> </ul> <!-- End Content Nav --> <!-- Start Comments Nav --> <span class="ul-header"><a id="toggle-commentsnav" href="#" class="toggle visible">Comments</a></span> <ul id="commentsnav"> <li><a class="icn_manage_comments" href="#">Manage Comments</a></li> <li><a class="icn_add_comments" href="#">Add Comments</a></li> <li><a class="icn_edit_comments" href="#">Edit Comments</a></li> <li><a class="icn_delete_comments" href="#">Delete Comments</a></li> </ul> here is the css used .toggle { display:block; } .ul-header a.visible { background:url('../img/icons/small/toggle_close.png') no-repeat scroll 97% 50%; } .ul-header a.hidden { background:url('../img/icons/small/toggle_open.png') no-repeat scroll 97% 50%; } Please help.

    Read the article

  • Radio button inside anchor element is reset after jQuery click handler

    - by GrievousAngel
    I have a situation where an element, of type radio, is contained in an element. The anchor element has a href but I want to override that behaviour by adding a jQuery 'click' handler to the element. The click handler makes the radio button inside it the selected one within the group. This all works when the anchor is clicked, however, when the radio button is clicked it appears that jQuery resets the selected radio to the previously selected one! Here is a the simplified page that duplicates the issue: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#a1").click(function(event) { anchorClicked("a1"); return false; }); $("#a2").click(function(event) { anchorClicked("a2"); return false; }); }); function anchorClicked(anchorId) { $('#' + anchorId + ' input:radio').attr("checked", true); alert("Look at what is selected and what happens after the event when this dialog is closed!"); } </script> </head> <body> <form> <ul> <li id="li1"> <a id="a1" href="javascript:alert('default functionality')"> <input value="1" name="rb" type="radio" id="rb1"> <span>Details 1</span> </a> </li> <li id="li2"> <a id="a2" href="javascript:alert('default functionality')"> <input value="2" name="rb" type="radio" id="rb2"> <span>Details 2</span> </a> </li> </ul> </form> </body> Does anyone have any idea how I can prevent jQuery for resetting the radio button?

    Read the article

  • Add jquery link to returned text...

    - by Jerry
    Hi all I am trying to add two jquery plugins files to my application. When a user triggers my ajax event, the server will return text with a form button. The plugins (a jquery calendar) will work when the user clicks the form button inside the returned text . I believe I have to add the link inside the return text instead of the main page to let the code work, but not sure how to do this. I am giving out my code and need you experts opinions. Thanks. My main page html //required jquery plugins ...didn't work if I add them in the main application. <script type="text/javascript" src="JS/date.js"></script> <script type="text/javascript" src="JS/datePicker.js"></script> <script type="text/javascript" src="JS/selectWeek.js"></script> <div id="gameInfo"> //return text will be displayed here. </div> My returned text ...part of it.... <form> <div id=returnDiv> // the form input will be added here when a user clicks #addMatch button... </div> <tr> <td><input type="button" id="addMatch" name="addMatch" value="Add Match"/> </td> </tr> </form> My jquery $("#addMatch").live('click', function(){ //the code below will create a calender when a user click the link...I am not sure //where I should add my two jquery plugins link... $("#returnDiv").html("<td><input type='text' size='6' class='date-pick dp-applied'"+ "name='date'><a style='color:white;' class='dp-choose-date' title='Choose Date'"+ "href='#'>Date</a></td>"; return false; }); I hope I explain my question well. +1 to any reply...:D

    Read the article

  • round slider select

    - by mmcgrail
    I am in need of a jquery based 360 rotational slider I want the user to be able to grab the end and rotate it 360 degrees anyone know of anything like that I can't seem to find one

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >