Search Results

Search found 359 results on 15 pages for 'preventdefault'.

Page 11/15 | < Previous Page | 7 8 9 10 11 12 13 14 15  | Next Page >

  • jquery events on input submit fields

    - by dfilkovi
    I have a problem with jquery submit button onclick and default event. What I want to do is replace an click event on submit button if it has one, and get an dialog box to show up, on clicking yes the dialog should start that default onclick event if submit button has one defined, if it hasn't than the default event should happen (button submits form), .submit() function does not work for me in any case cause I need to send this button also through a form and if button wasn't clicked .submit() sends form data without submit data. Bellow code has a problem, alert('xxx') is always called and it shouldn't, and on clicking yes button alert and dialog creation is called again, also if I remove alert button, I cannot call default submit button event (form submitting with a button). $('input.confirm').each(function() { var input = this; var dialog = document.createElement("div"); $(dialog).html('<p>AREYOUSHURE</p>'); $(input).click(function(event) { event.preventDefault(); var buttons = {}; buttons['NO'] = function() { $(this).dialog("close"); }; buttons['YES'] = function() { $(input).trigger('click'); $(this).dialog("close"); }; $(dialog).dialog( { autoOpen: false, width: 200, modal: true, resizable: false, buttons: buttons }); $(dialog).dialog('open'); return false; }); }); <form method="post" action=""> <input type="hidden" value="1" name="eventId" /> <input type="submit" value="Check" name="checkEvent" class="confirm" onclick="alert('xxx');" /> </form>

    Read the article

  • JQuery Checkbox generation

    - by Hash
    I have used the following code to generate some dynamic checkboxes. This works for the first time and adds the check box chk2 to the page and then after the trigger for the $('#newLink').click is not working. Please help me with this. <div id="chkBoxesDiv"> <input type="checkbox" id="chk1" ></input> <input id="answerText" type="text" size="30" ></input>&nbsp; <input type="button" value="add new" id="newLink"/> </div> $(document).ready(function(){ $('#newLink').click(function (event){ var i = 0; //To count the children $("#chkBoxesDiv").children().each(function(){ var child = $(this); if(child.is(":checkbox")){ i++; } }); //prevent action event.preventDefault(); //get textbox value to fill checkbox var text = $("#answerText").val(); alert(i); //if text not empty do stuff if(text != ""){ //add label $("#chk"+i).after("<label for=\"chk"+i+"\" id=\"lblchk"+i+"\">"+text+"</label>"); $("#newLink").remove(); $("#answerText").remove(); $("#lblchk1").after("<br /><input type=\"checkbox\" id=\"chk"+(1+i)+"\" ></input><input type=\"text\" id=\"answerText\" size=\"30\" ></input>&nbsp;<input type=\"button\" value=\"add new\" id=\"newLink\"/>"); } }); });

    Read the article

  • jQuery: bind generated elements

    - by superUntitled
    Hello, thank you for taking time to look at this. I am trying to code my very first jQuery plugin and have run into my first problem. The plugin is called like this <div id="kneel"></div> <script type="text/javascript"> $("#kneel").zod(1, { }); </script> It takes the first option (integer), and returns html content that is dynamically generated by php. The content that is generated needs to be bound by a variety of functions (such as disabling form buttons and click events that return ajax data. The plugin looks like this (I have included the whole plugin in case that matters)... (function( $ ){ $.fn.zod = function(id, options ) { var settings = { 'next_button_text': 'Next', 'submit_button_text': 'Submit' }; return this.each(function() { if ( options ) { $.extend( settings, options ); } // variables var obj = $(this); /* these functions contain html elements that are generated by the get() function below */ // disable some buttons $('div.bario').children('.button').attr('disabled', true); // once an option is selected, enable the button $('input[type="radio"]').live('click', function(e) { $('div.bario').children('.button').attr('disabled', false); }) // when a button is clicked, return some data $('.button').bind('click', function(e) { e.preventDefault(); $.getJSON('/returnSomeData.php, function(data) { $('.text').html('<p>Hello: ' + data + '</p>'); }); // generate content, this is the content that needs binding... $.get('http://example.com/script.php?id='+id, function(data) { $(obj).html(data); }); }); }; })( jQuery ); The problem I am having is that the functions created to run on generated content are not binding to the generated content. How do I bind the content created by the get() function?

    Read the article

  • Noobie Jquery Question

    - by piratebill
    I've been working with Jquery fro a grand total of two hours now. Up until this point I have made this really simple FAQ page. <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#void").click(function(event) { event.preventDefault(); }); $('#faq').find('dd').hide().end().find('dt').click(function() { $(this).next().slideToggle(); }); }); </script> <dl id="faq"> <dt><a href="" id="void">Coffee</a></dt> <dd>- black hot drink</dd> <dt><a href="" id="void">Milk</a></dt> <dd>- white cold drink</dd> </dl> The problem is only the first item is working. My questions are, why is only the first entree working and how do I fix it? I've tried using an each() but I am unsure where to put it.

    Read the article

  • I can't prevent key presses from changing a selected option in Firefox

    - by Anthony
    Using Firefox 3.5.7 The following test page should behave like Opera, Safari and Chrome. Key presses (arrows or 1-5) should have no effect (i.e. The events should be cancelled so that the number never changes from the initial default "3"). [I have separate working code for IE too]. Many thanks to anyone who can make it work? <html> <head> <title>Test</title> <script type='text/JavaScript'> function stop(evt) {evt.preventDefault(); evt.stopPropagation(); }; </script> </head> <body> <select onkeydown='stop(event);' onkeypress='stop(event);'> <option>1</option> <option>2</option> <option selected="selected">3</option> <option>4</option> <option>5</option> </select> </body> </html>

    Read the article

  • jQuery broken function after added new function

    - by Kyle Sevenoaks
    What's wrong here? The alert function was working until I added this new function to it. Is there anything I am doing wrong? It just simply doesn't fire the alert anymore. <input value="1" type="checkbox" name="salgsvilkar" id="checkbox2" style="float:left;" /> {literal} <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function() { //checkbox $("#scrollwrap").click(function(){ $("#scrollwrap").toggleClass('highlight'); });? }); $(function(){ //button $("#fullfor_btn").click(function(e){ if(!$("#checkbox2").is(':checked') == false) { alert("Please accept the terms of sale."); e.preventDefault(); } }); }); </script> {/literal} <button type="submit" class="submit" name="{$method}" id="fullfor_btn" title="Fullfør bestillingen nå" value="">&nbsp;</button>

    Read the article

  • Get the id of the link and pass it to the jQueryUI dialog widget

    - by Mike Sanchez
    I'm using the dialog widget of jQueryUI. Now, the links are grabbed from an SQL database by using jQuery+AJAX which is the reason why I used "live" $(function() { var $dialog = $('#report') .dialog({ autoOpen: false, resizable: false, modal: true, height: 410, width: 350, draggable: true }) //store reference to placeholders $uid = $('#reportUniqueId'); $('.reportopen').live("click", function (e) { $dialog.dialog('open'); var $uid = $(this).attr('id'); e.preventDefault(); }); }); My question is, how do I pass the id of the link that triggered the dialog widget to the dialog box itself? The link is set up like this: <td align="left" width="12%"> <span id="notes"> [<a href="javascript:void(0)" class="reportopen" id="<?=$reportId;?>">Spam</a>] </span> </td> And the dialogbox is set up like this: <div id="report" title="Inquire now"> HAHAHAHAHA <span id="reportUniqueId"></span> </div> I'd like for the id to be passed and generated in the <span id="reportUniqueId"></span> part of the dialog box. Any idea?

    Read the article

  • jQuery / Loading content into div and changing url's (working but buggy)

    - by Bruno
    This is working, but I'm not being able to set an index.html file on my server root where i can specify the first page to go. It also get very buggy in some situations. Basically it's a common site (menu content) but the idea is to load the content without refreshing the page, defining the div to load the content, and make each page accessible by the url. One of the biggest problems here it's dealing with all url situations that may occur. The ideal would be to have a rel="divToLoadOn" and then pass it on my loadContent() function... so I would like or ideas/solutions for this please. Thanks in advance! //if page comes from URL if(window.location.hash != ''){ var url = window.location.hash; url = '..'+url.substr(1, url.length); loadContent(url); } //if page comes from an internal link $("a:not([target])").click(function(e){ e.preventDefault(); var url = $(this).attr("href"); if(url != '#'){ loadContent($(this).attr("href")); } }); //LOAD CONTENT function loadContent(url){ var contentContainer = $("#content"); //set load animation $(contentContainer).ajaxStart(function() { $(this).html('loading...'); }); $.ajax({ url: url, dataType: "html", success: function(data){ //store data globally so it can be used on complete window.data = data; }, complete: function(){ var content = $(data).find("#content").html(); var contentTitle = $(data).find("title").text(); //change url var parsedUrl = url.substr(2,url.length) window.location.hash = parsedUrl; //change title var titleRegex = /(.*)<\/title/.exec(data); contentTitle = titleRegex[1]; document.title = contentTitle; //renew content $(contentContainer).fadeOut(function(){ $(this).html(content).fadeIn(); }); }); }

    Read the article

  • IE AJAX/Jquery issue - redirecting to new page instead of loading it into a div

    - by phx-zs
    I have a page like this: <form class="ajax" method="post" action="add_item.php"> [text input] [submit button] </form> [list any items the user has in a div here called #items] When the user clicks the submit button, a function like this is called: $("form.ajax").live('submit', function(event) { params = $(this).serialize(); $.post($(this).attr("action"), params, function(data){ json = $.parseJSON(data); // do stuff based on the json results if(json.success.action == 'replace'){ $(json.success.container).html(json.success.message); } else{ $(json.success.container).prepend(json.success.message); $(json.success.container).find(".item:first").slideDown(); } }); event.returnValue = false; return false; }); This is supposed to load add_item.php into the #items div, and it works fine in FF, Chrome, Safari, just not IE. In IE (tested 7 and 8) when I click Submit it redirects the page to add_item.php rather than loading it into the #items div. I tried adding event.preventDefault(); to the end of the function but that didn't work. Any ideas?

    Read the article

  • how to get data from another file?

    - by Ronnie Chester Lynwood
    hey guys i got this jquery codes: jQuery(function ($) { var OSX = { container: null, init: function () { $("input.osx, a.osx").click(function (e) { e.preventDefault(); $("#osx-modal-content").modal({ overlayId: 'osx-overlay', containerId: 'osx-container', closeHTML: null, minHeight: 80, opacity: 65, position: ['0',], overlayClose: true, onOpen: OSX.open, onClose: OSX.close }); }); }, open: function (d) { var self = this; self.container = d.container[0]; d.overlay.fadeIn('slow', function () { $("#osx-modal-content", self.container).show(); var title = $("#osx-modal-title", self.container); title.show(); d.container.slideDown('slow', function () { setTimeout(function () { var h = $("#osx-modal-data", self.container).height() + title.height() + 20; // padding d.container.animate( {height: h}, 200, function () { $("div.close", self.container).show(); $("#osx-modal-data", self.container).show(); } ); }, 300); }); }) }, close: function (d) { var self = this; // this = SimpleModal object d.container.animate( {top:"-" + (d.container.height() + 20)}, 500, function () { self.close(); // or $.modal.close(); } ); } }; OSX.init(); }); this js is gets #osx-modal-content,#osx-modal-title,#osx-modal-data from index.php. how can i get divs from another page? thanks

    Read the article

  • Location of Embedly (JQuery-Preview) Results

    - by user749798
    Embedly/Jquery-Preview has been fantastic. However, I'm trying to change the location of the preview result, and having trouble. Right now, the result appears right below the input field...but I'd rather have it in a separate part of the page. Is there a way to do this? I've tried changing the location of the selector and loading divs, but that hasn't helped. It seems to ignore those divs and put it right below the submit button. Below is my code: <form accept-charset="UTF-8" action="private" class="new_comment" data-remote="true" id="new_comment" method="post"> <input class="photo_comm" id="comment_comment" name="comment[comment]" placeholder="add a comment or link..." size="30" type="text" /><span type="text" id="counter">1000</span> <input class="btn btn-primary btn-mini" data-disable-with="Submitting..." name="commit" type="submit" value="Post" /> </form> <!-- Placeholder that tells Preview where to put the loading icon--> <div class="loading"> <img src='http://embedly.github.com/jquery-preview/images/loading-rectangle.gif'> </div> <!-- Placeholder that tells Preview where to put the selector--> <div class="selector"></div> $('#comment_comment').preview({ key:'60f1dcdf3258476794784148a6eb65e7', // Sign up for a key: http://embed.ly/pricing selector : {type:'rich'}, preview : { submit : function(e, data){ e.preventDefault(); $.ajax({ dataType: 'script', url: this.form.attr('action'), type: 'POST', data: data }); }, }, autoplay : 0, maxwidth : 400, display : {display : 'rich'} });

    Read the article

  • Jquery ajax ($.ajax) not working on chrome. please help

    - by racky
    Hi, I need a little help to figure out why the following code does not work on google chrome 5/windows xp. It works well on all other browsers (IE, FF, Safri, Opera etc). Can someone shed some light around this? /* AJAX Request */ jq("#a-post-request").unbind("click").bind("click", function(e){ //jq("#loading").css({"display":"block"}); jq.ajax({ url: "search_data_table.html", type: "get", cache: false, error: function(){alert ("No data found for your search.");}, success: function(data){ jq("#search-results-table tbody").empty().append(data); jq("#search-results").css({"display":"block"}); jq("#search-results-table").trigger("update"); // this one is for the table sorter plugin // set sorting column and direction, this will sort on the first column. var sorting = [[0,0]];// this one is for the table sorter plugin // sort on the first column . jq("#search-results-table").trigger("sorton",[sorting]);// this one is for the table sorter plugin e.preventDefault(); } }); }); Many thanks, Racky

    Read the article

  • Show iPad keyboard on select, focus or always (jQuery)

    - by Ryan
    I have a web app that is using jQuery to replace the RETURN key with TAB so that when I user presses return the form is not submitted but rather the cursor moves to the next text field. This works in all browsers but only 1/2 works on the iPad. On the iPad the next field is highlighted but the keyboard is hidden. How can I keep the keyboard visible or force it somehow? Here's my code (thanks to http://thinksimply.com/blog/jquery-enter-tab): function checkForEnter (event) { if (event.keyCode == 13) { currentBoxNumber = textboxes.index(this); if (textboxes[currentBoxNumber + 1] != null) { nextBox = textboxes[currentBoxNumber + 1] nextBox.focus(); nextBox.select(); event.preventDefault(); return false; } } } Drupal.behaviors.formFields = function(context) { $('input[type="text"]').focus(function() { $(this).removeClass("idleField").addClass("focusField"); }); $('input[type="text"]').blur(function() { $(this).removeClass("focusField").addClass("idleField"); }); // replaces the enter/return key function with tab textboxes = $("input.form-text"); if ($.browser.mozilla) { $(textboxes).keypress (checkForEnter); } else { $(textboxes).keydown (checkForEnter); } };

    Read the article

  • This code is not working in IE8 Browser.. but works in Firefox

    - by rockers
    $('#PbtnSubmit').click(function(event) { $('#PricingEditExceptions input[name=PMchk]').each(function() { if ($("#PricingEditExceptions input:checkbox:checked").length > 0) { var checked = $('#PricingEditExceptions input[type=checkbox]:checked'); var PMstrIDs = checked.map(function() { return $(this).val(); }).get().join(','); $('#1_exceptiontypes').attr('value', exceptiontypes) $('#1_PMstrIDs').attr('value', PMstrIDs); } else { alert("Please select atleast one exception"); event.preventDefault(); } }); }); I am sending exceptiondis to the Controler to handle the update.. this is my Begin form.. <script type="text/javascript"> var exceptiontypes = $.cookie("exceptiontype"); </script> <% using (Html.BeginForm("MassUpdate", "Pricing", FormMethod.Post, new { @id = "exc-"})) { %> <input type="hidden" id="exceptiontypes" runat="server" /> <input type="hidden" id="PMstrIDs" value="" runat="server"/> <%= Html.ValidationSummary(true)%> I am retreving the ExceptionId;s controler side is like this.. var exceptionIds = Request.Form[1].Split(','); var exceptiontype = Request.Form[0]; how ever this is working in firefox not in IE8.. Ie8 I am getting only Frist ExcdptionId not all checkbox exceptions ids; thanks

    Read the article

  • How to load two divs into separate targets with JQuery?

    - by Bussard
    Hi all, I'm trying to achieve two things, both of which I fail to get at. On a server are a series of notes; all contain a div (id=ajxContent). Some notes also contain an additiona div (id=ajxHead). The ajxContent itself contains links (class=clicking) to call the next installment, hence the link destination in a variable. This is my code: $(document).ready(function(){ $( 'a.clicking' ).live('click', function(e){ e.preventDefault(); var theLink = $(this).attr('href'); $('#loadText').load(theLink + '#ajxContent'); $('h1').load(theLink + '#ajxHead'); }); }) Where it fails: 1) the ajxContent gets loaded into the h1 tag as well as in its intended target. 2) when I had set up the code differently, if there was no div id=ajxHead present in a note, the load would nevertheless erase the existing value in the h1 tag. Am I on a totally wrong track here, with two load statements? Input is very welcome, thanks.

    Read the article

  • jquery focusin() and preventing bubbling.

    - by DA
    I'm showing a div via an onclick event. If you click outside the div, I want to hide it. To do so, I'm binding a one time click event on the body: $('body').one('click.myDivPopup', function(e) { ...close my div... }); Within the div itself, I tell it to not propogate events so that actually clicking within the div won't trigger a click on the body: $myDiv.click(function(e){e.stopPropagation()}); This works fine as intended. I also want to hide the div if one tabs out of the div. My thinking was that in that scenario, I could use a focusin event on the body: $('body').one('focusin.myDivPopup', function(e) { ...close my div... }); Again, I don't want the events to bubble out of the div itself, so added this: $myDiv.focusin(function(e){e.preventDefault()}); This does NOT work. Changing focus within elements within myDiv triggers the focusin event on the body. Is this maybe a bug in jQuery? If so is there a better way to accomplish this?

    Read the article

  • Passing Object From Controller to JavaScript JQuery

    - by TMan
    This is driving me crazy. All I'm trying to do is to pass in a Id to a ActionMethod which is working and have an Object be returned to the javascript. Then in javascript, I want to be able to say something like..Objec.Property, ie/ Student.Name, or Student.GPA. Any help is appreciated. I tried json but couldn't get that to work either. ActionResult: [AcceptVerbs(HttpVerbs.Get)] public Epic GetEpicPropertyDetails(int id) { var Epictemplist = epicRepository.Select().Where(x => x.Id.Equals(id)); return Epictemplist.SingleOrDefault(); } javascript: <script type="text/javascript"> $(document).ready(function () { $(".ListBoxClass").click(function (event) { var selectedid = $(this).find("option:selected").val(); event.preventDefault(); $.get("/Estimate/GetEpicPropertyDetails", { id: selectedid }, function (result) { $(".TimeClass").val(result); }); }); }); </script> result.Name is obviously wrong I just dont know how to call this the right way.

    Read the article

  • How can I [simply] consume JSON Data in a Line of Business Web Application

    - by Atomiton
    I usually use JSON with jQuery to just return a string with html. However, I want to start to use Javascript objects in my code. What's the simplest way to get started using json objects on my page? Here's a sample Ajax call ( after $(document).ready( { ... }) of course: $('#btn').click(function(event) { event.preventDefault(); var out = $('#result'); $.ajax({ url: "CustomerServices.asmx/GetCustomersByInvoiceCount", success: function(msg) { // // Iterate through the json results and spit them out to a page? // }, data: "{ 'invoiceCount' : 100 }" }); }); My WebMethod: [WebMethod(Description="Gets customers with more than n invoices")] public List<Customer> GetCustomersByInvoiceCount(int? invoiceCount) { using (dbDataContext db = new dbDataContext()) { return db.Customers.Where(c => c.InvoiceCount >= invoiceCount); } } What gets returned: {"d":[{"__type":"Customer","Account":"1116317","Name":"SOME COMPANY","Address":"UNit 1 , 392 JOHN ST. ","LastTransaction":"\/Date(1268294400000)\/","HighestBalance":13922.34},{"__type":"Customer","Account":"1116318","Name":"ANOTHER COMPANY","Address":"UNIT #345 , 392 JOHN ST. ","LastTransaction":"\/Date(1265097600000)\/","HighestBalance":549.42}]} What I'd LIKE to know, is what are people generally doing with this returned json? Do you iterate through the properties and create an html table on the fly? Is there way to "bind" JSON data using a javascript version of reflection ( something like the .Net GridView Control ) Do you throw this returned data into a Javascript Object and then do something with it? An example of what I want to achieve is to have an plain ol' html page ( on a mobile device )with a list of a Salesperson's Customers. When one of those customers are clicked, the customer id gets sent to a webservice which retrieves the customer details that are relevant to a sales person. I know the SO talent pool is quite deep so I figured you all here would be able to guide in the right direction and give me a few ideas on the best way to approach this.

    Read the article

  • No results are returned when using Flickr JSON request

    - by Martijn1981
    I'm still fairly new to AJAX and I'm experimenting with Twitter and Flickr. Twitter is working fine so far, but I've run into some issues with the Flickr API. I'm getting no results back. The URL seems to be working fine and I'm pointing to the right object containing the array ('items'). Can anybody tell me what I'm doing wrong please? Thanks! $('#show_pictures').click(function(e){ e.preventDefault(); $.ajax({ url: 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&jsoncallback=?&tags=home', dataType: 'jsonp', success: function(data) { $.each(data.items, function(i, item){ $('<div></div>') .hide() .append('<h1>'+item.title+'</h1>') .append('<img src="'+item.media.m+'" >') .append('<p>'+item.description+'</p>') .appendTo('#results') .fadeIn(); }) }, error: function(data) { alert('Something went wrong!'); } }); });

    Read the article

  • Waiting until one event has happened before moving onto the next.

    - by jaasum
    I currently have a scrolling anchor animation that also adds an "active" class to the anchor clicked. I am trying to fit the below function into the works as well, so say someone clicks "anchor 1", "anchor 1" will get an active class and the window will scroll to that location. But, after that has happened say the user manually begins scrolling down the page, I want the active class to be removed. The problem I am running up against now is that the below function will happen when the scrolling animation from a clicked anchor is taking place. How can I disable this only when the window is being scrolled from a clicked anchor? $(window).scroll(function() { $('a[href^=#]').removeClass('active'); }); Here is the scrolling anchor script I am working with. /******* *** Anchor Slider by Cedric Dugas *** *** Http://www.position-absolute.com *** Never have an anchor jumping your content, slide it. Don't forget to put an id to your anchor ! You can use and modify this script for any project you want, but please leave this comment as credit. *****/ jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 500 }, settings); return this.each(function(){ var caller = this $(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = $(caller).attr("href") var destination = $(elementClick).offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, 'easeOutCubic', function() { window.location.hash = elementClick }); return false; }) }) } And lastly, my jQuery // Scrolling Anchors $('[href^=#]').anchorAnimate(); // Active Class For Clicked Anchors var anchorscroll = $('a[href^=#]') anchorscroll.click(function(){ var anchorlocation = $(this).attr("href"); anchorscroll.removeClass('active'); $(this).addClass('active'); $('a[href='+anchorlocation+']').addClass('active'); });

    Read the article

  • Timing issues with playback of the HTML5 Audio API

    - by pat
    I'm using the following code to try to play a sound clip with the HTML5 Audio API: HTMLAudioElement.prototype.playClip = function(startTime, stopTime) { this.stopTime = stopTime; this.currentTime = startTime; this.play(); $(this).bind('timeupdate', function(){ if (this.ended || this.currentTime >= stopTime) { this.pause(); $(this).unbind('timeupdate'); } }); } I utilize this new playClip method as follows. First I have a link with some data attributes: <a href=# data-stop=1.051 data-start=0.000>And then I was thinking,</a> And finally this bit of jQuery which runs on $(document).ready to hook up a click on the link with the playback: $('a').click(function(ev){ $('a').click(function(ev){ var start = $(this).data('start'), stop = $(this).data('stop'), audio = $('audio').get(0), $audio = $(audio); ev.preventDefault(); audio.playClip(start,stop); }) This approach seems to work, but there's a frustrating bug: sometimes, the playback of a given clip plays beyond the correct data-stop time. I suspect it could have something to do with the timing of the timeupdate event, but I'm no JS guru and I don't know how to begin debugging the problem. Here are a few clues I've gathered: The same behavior appears to come up in both FF and Chrome. The playback of a given clip actually seems to vary a bit -- if I play the same clip a couple times in a row, it may over-play a different amount of time on each playing. Is the problem here the inherent accuracy of the Audio API? My app needs milliseconds. Is there a problem with the way I'm using jQuery to bind and unbind the timeupdate event? I tried using the jQuery-less approach with addEventListener but I couldn't get it to work. Thanks in advance, I would really love to know what's going wrong.

    Read the article

  • IE and replaceWith not preserving radio button state

    - by copelco
    Hello, I've run into an issue regarding replaceWith not maintaining the state of a moved radio button input. I've prepared a simple example illustrating this issue. This works in FF and Chrome, but not IE. Is there a way around this? Thanks! jsbin: http://jsbin.com/unola4/2 code: <html> <head> <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <title>IE replaceWith issue</title> <script type='text/javascript'> $(function(){ $('a').click(function(e) { e.preventDefault(); $('#temp').replaceWith($('#window').children()); }); }); </script> </head> <body> <a href='#'>run replaceWith</a> <p>Select a radio button and then click "run replaceWith". The value persists in FF, but not IE.</p> <div id='window' style='background-color: #DDD; height: 100px;'> <input id="id_received_date-days_0" type="radio" name="received_date-days" value="30" /> <input id="id_received_date-days_1" type="radio" name="received_date-days" value="50" /> <input type='text' name='test-test' /> </div> <br /> <form id='foo' style='background-color: #EEE'> <div id='temp'></div> </form> </body> </html>

    Read the article

  • Post JSON array to mvc controller

    - by Yustme
    I'm trying to post a JSON array to a mvc controller. But no matter what i try, everything is 0 or null. I have this table that contains textboxes. I need from all those textboxes it's ID and value as an object. This is my java code: $(document).ready(function () { $('#submitTest').click(function (e) { var $form = $('form'); var trans = new Array(); var parameters = { TransIDs: $("#TransID").val(), ItemIDs: $("#ItemID").val(), TypeIDs: $("#TypeID").val(), }; trans.push(parameters); if ($form.valid()) { $.ajax( { url: $form.attr('action'), type: $form.attr('method'), data: JSON.stringify(parameters), dataType: "json", contentType: "application/json; charset=utf-8", success: function (result) { $('#result').text(result.redirectTo) if (result.Success == true) { return fase; } else { $('#Error').html(result.Html); } }, error: function (request) { alert(request.statusText) } }); } e.preventDefault(); return false; }); }); This is my view code: <table> <tr> <th>trans</th> <th>Item</th> <th>Type</th> </tr> @foreach (var t in Model.Types.ToList()) { { <tr> <td> <input type="hidden" value="@t.TransID" id="TransID" /> <input type="hidden" value="@t.ItemID" id="ItemID" /> <input type="hidden" value="@t.TypeID" id="TypeID" /> </td> </tr> } } </table> This is the controller im trying to receive the data to: [HttpPost] public ActionResult Update(CustomTypeModel ctm) { return RedirectToAction("Index"); } What am i doing wrong?

    Read the article

  • multiple ajax request to action in asp.net mvc

    - by persian Dev
    I am developing an asp.net mvc application and have ajax calls on my page. Here is a form which I load by ajax call to page : The form is located in a partial view <div id="CreateCultureArea"> <% using (Ajax.BeginForm("CreateCulture", "Admin", new AjaxOptions() { OnSuccess = "handleCreateCulture" })) { %> ..... <% } %> </div> The following script is located in a view $('.CreateCulture').live('click', function (e) { e.preventDefault(); var idval = this.id; $.ajax({ url: "/Admin/CreateCulture", dataType: 'html', data: { id: idval }, success: function (mydata) { $("#CultureContentArea").empty(); $("#CultureContentArea").empty().hide().append(mydata).fadeIn(2000); $("form").removeData("validator"); $("form").removeData("unobtrusiveValidation"); $.validator.unobtrusive.parse("form"); }, type: "GET" }); return false; }) </script> When users click on a link with CreateCulture class, the form is loaded to page. But as I saw the requests in firebug, it calls the action multiple times. I read similar posts like mine on stackoverflow.com and most of them suggested removing repetitive "jquery.unobtrusive-ajax.min.js" calss in page, but as I saw the output page I only see on link to the "jquery.unobtrusive-ajax.min.js" script.

    Read the article

  • Javascript int variable from ASP.NET MVC Model data?

    - by Anders Svensson
    I need to get model data into a javascript variable and use it as an int to compare values. But I can only figure out how to get the model data as strings, otherwise the compiler complains. So how can I get the max and taskBudgetHours as int variables in the Javascript? <script type="text/javascript"> $(document).ready(function () { $("#taskForm").submit(function (e) { var taskBudgetHours = $('#BudgetHours').val(); var max = '<%: Model.Project.RemainingBudgetHours %>'; var test = 'test'; alert(taskBudgetHours); alert(max); if (taskBudgetHours <= max) { //This doesn't work, seems to treat it as strings... return true; } else { //Prevent the submit event and remain on the screen e.preventDefault(); alert('There are only ' + max + ' hours left of the project hours.'); return false; } }); return; }); </script>

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15  | Next Page >