Search Results

Search found 4827 results on 194 pages for 'alert'.

Page 32/194 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • DOM Level 3 CustomEvents not bubbling on WebKit

    - by Edu Felipe
    I'm observing CustomEvents not bubbling, even though I set bubbling to true. The code below: var evt = document.createEvent("CustomEvent") evt.initCustomEvent("mycustomevent", true, false) var someh1 = document.getElementById("someh1") someh1.addEventListener("mycustomevent", function(){ alert("OMG!"); }) document.getElementsByTagName("body")[0].dispatchEvent(evt) With the HTML below: <html> <head></head> <body> <h1 id="someh1">content!</h1> </body> </html> Never shows the alert, demonstrating that the event is not bubbling down. Am I doing something wrong? Please note that if I do a getElementById("someh1") and run the dispatchEvent on it, the alert is displayed. Thanks!

    Read the article

  • jQuery offset combined with jQuery UI doesn't update on drag

    - by Constructor
    I need to get the offset of the element that is being dragged and I use: $(function(){ $(".draggable").draggable({ stop: function(){ var offset = $("#boxone").offset(); alert(offset.left); } }); }); the element is positioned absolute and has a CSS of: left:100px; that is the value I get on the alert when I drag the element (even multiple times). What I want is to get it to alert the current offset (if I drag in 200px to the right it should say 300)

    Read the article

  • Mouse down Issue

    - by 3gwebtrain
    HI, I am making my own scroll bar. in which i made this code below i pasted. i am getting the issue from this code. i) in the first time i am pressing "#scroller" that works fine. ii) in case of second or other time when i am enter into "#scroller" itself, i am getting the alert "hi", instead of i am pressing the "#scroller", i know that i am doing some wrong this with my code, but i unable to find the mistake. Any one help me? $(function(){ var slidesWidth = ($('#show-content li').length)*($('#show-content li').width()+20); $('#show-content ul').width(slidesWidth); var scrollBarWidth = (100/slidesWidth)*1000;//presently taken by manual/ $('#scroller').width(scrollBarWidth); $('#scroller').bind('mousedown',function(){ $('#scroller').mousemove(function(){ alert('hi'); }) }) $('#scroller').bind('mouseup',function(){ $('#scroller').unbind('mousedown,mousemove'); alert('unbinded'); }) })

    Read the article

  • Customized alerts in Javascript not working properly

    - by mmh
    I am developing an addon to Firefox using addon-builder. I want to replace a normal alert box in Javascript with my addon. So, I have choosen customized alert boxes using jQuery. The jAlert details are given here. Now, I made customized alerts (with title and colors in alert). It is wroking properly on some websites. But on some websites the default CSS is dominating my jQuery CSS, which leads to unexpected alerts (ugly alerts).

    Read the article

  • how to jquery event bind to function

    - by sunglim
    $(function(){ $("#btnExcelRead").click(CheckValidation); }); var CheckValidation = function() { if ($("#excelUpload").val() === "") { alert("Select file"); return false; } if ($("$txtStartDate").val() === "") { alert("Check the start date!"); return false; } if ($("$txtEndDate").val() === "") { alert("Check the end date!"); return false; } } here i made simple jquery code. I want to bind function when btnExcelRead button click. is this originally wrong way?

    Read the article

  • Execute dynamic function with param in javascript

    - by Valamas
    if the following possible? I wish to move the alert(result) into a function and to dynamically call it. Current $.ajax(this.href, { success: function (result) { alert(result); AjaxComplete(); } }); My Attempt - not working $.ajax(this.href, { success: function (result) { window["MyAlert(result)"](); AjaxComplete(); } }); function MyAlert(result) { alert(result); } Is this possible?

    Read the article

  • Javascript replace using regexp

    - by netcrash
    <input type="text" value="[tabelas][something][oas]" id="allInput"> <script type="text/javascript"> allInput = document.getElementById('allInput'); var nivel = new Array('tabelas', 'produto'); for (var i =0; i < nivel.length ; i++ ) { alert(" oi => " + allInput.value + " <-- " + nivel[i]) ; var re = new RegExp("^\[" + nivel[i] + "\]\[.+\].+", "g"); alert(re); allInput.value = allInput.value.replace( re, "OLA"); alert(" oi 2 => " + allInput.value + " <-- " + nivel[i]) ; } </script> Basically I whant to replace "something2 in the [tabelas][something][otherfield] by a number of quantity, I have been playing with regexp and had different results from this using .replace(/expression/,xxx ) and new RegExp() . Best regards and thank you for any help.

    Read the article

  • return from jquery ajax call

    - by michael
    hi im tryin to use the return from a jquery ajax call in my own function, but it keeps returning undefined. function checkUser2(asdf) { $.ajax({ type: "POST", async: false, url: "check_user.php", data: { name: asdf }, success: function(data){ return data; //alert(data); } }); } $("#check").click(function(){ alert(checkUser2("muma")); }); the ajax call definately works, because when i uncomment my alert i get the correct return, and i can see it in firebug. Am i doing something stupid.

    Read the article

  • How to use $.get data to replace certain elements in a webpage?

    - by Jack Ha
    I'm using jQuery 1.4.2 to navigate smoothly between similar webpages (in ff3). When clicking on a link, a javascript script should load the new html, filter out the right elements and replace them on the current page. It looks like the $(htmlcode) does not do the thing I expected. The actions below work when loading the page directly, but when using the $.get I have the following problems: the find function seems only to look inside a div element called id="page", which is inside the body element one of the elements has <script>...</script>, but the <script>...</script> is not present in the DOM of $(htmlcode). Anybody knows how to solve this? $.get( url, function(responseText, textStatus, xmlHttpRequest) { alert($(responseText).find("#header")); // works, #header is inside div#page alert($(responseText).find("#header").html()); // displays content, but WITHOUT the <script>...</script> alert($(responseText).find("title")); // does not work, title is outside div#page } );

    Read the article

  • Jquery function calls more than one time.

    - by Harie
    I am having an aspx page in which I am calling a user control. The user control I am using a pop up to display it when a user clicks a asp:linkbutton. In that user control I am having a textbox and I am calling a Jquery Blur to do some validation. While doing so the function is calling [blur] is calling twice. I just called an alert() with the textbox value.So I can see the alert is coming twice .What I need to do to avoid the second time. I need to do it only whenever the user going out of the textbox and that also one time. $('#<%=txtCategory.ClientID %>').blur(function() { alert($(this).val()); }); This is called twice.Thanks for ur response.

    Read the article

  • JavaScript inner function scope chain?

    - by Ding
    In this example var a = 1; ( function(x) { function inner() { alert(a); alert(x); alert(y); } var y = 3; inner(); })(2); When does function inner get created? during execution time or parsing time of outer anonymous function? What is in the scope chain of function inner? What is in the execution context of function inner? I know it is not a simple question, thanks for enlighting me in advance!

    Read the article

  • Failing rspec Rails Tutorial Chapter 9.3

    - by greyghost24
    I am failing 3 tests and I have found numerous examples on here and on on the internet in general but I can't seem to find where I'm going wrong. Thanks for any help. 1) User pages signup with valid information edit page Failure/Error: before { visit edit_user_path(user) } ActionView::Template::Error: undefined method `model_name' for NilClass:Class # ./app/views/users/edit.html.erb:6:in `_app_views_users_edit_html_erb___4113112884365867193_70232486166220' # ./spec/requests/user_pages_spec.rb:96:in `block (5 levels) in <top (required)>' 2) User pages signup with valid information edit page Failure/Error: before { visit edit_user_path(user) } ActionView::Template::Error: undefined method `model_name' for NilClass:Class # ./app/views/users/edit.html.erb:6:in `_app_views_users_edit_html_erb___4113112884365867193_70232486166220' # ./spec/requests/user_pages_spec.rb:96:in `block (5 levels) in <top (required)>' 3) User pages signup with valid information edit page Failure/Error: before { visit edit_user_path(user) } ActionView::Template::Error: undefined method `model_name' for NilClass:Class # ./app/views/users/edit.html.erb:6:in `_app_views_users_edit_html_erb___4113112884365867193_70232486166220' # ./spec/requests/user_pages_spec.rb:96:in `block (5 levels) in <top (required)>' Finished in 0.26515 seconds 3 examples, 3 failures Failed examples: rspec ./spec/requests/user_pages_spec.rb:100 # User pages signup with valid information edit page rspec ./spec/requests/user_pages_spec.rb:99 # User pages signup with valid information edit page rspec ./spec/requests/user_pages_spec.rb:101 # User pages signup with valid information edit page authentication_pages_spec.rb require 'spec_helper' describe "Authentication" do subject { page } describe "signin page" do before { visit signin_path } it { should have_selector('h1', text: 'Sign in') } it { should have_selector('title', text: 'Sign in') } end describe "signin" do before { visit signin_path } describe "with invalid information" do before { click_button "Sign in" } it { should have_selector('title', text: 'Sign in') } it { should have_selector('div.alert.alert-error', text: 'Invalid') } describe "after visiting another page" do before { click_link "Home" } it { should_not have_selector('div.alert.alert-error') } end end describe "with valid information" do let(:user) { FactoryGirl.create(:user) } before do fill_in "Email", with: user.email fill_in "Password", with: user.password click_button "Sign in" end it { should have_selector('title', text: user.name) } it { should have_link('Profile', href: user_path(user)) } it { should have_link('Sign out', href: signout_path) } it { should_not have_link('Sign in', href: signin_path) } describe "followed by signout" do before { click_link "Sign out" } it { should have_link('Sign in') } end end end end Here is the users_controller: class UsersController < ApplicationController def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(params[:user]) if @user.save sign_in @user flash[:success] = "Welcome to the Sample App!" redirect_to @user else render 'new' end end end def edit @user = User.find(params[:id]) end edit.html.erb: <% provide(:title, "Edit user") %> <h1>Update your profile</h1> <div class="row"> <div class="span6 offset3"> <%= form_for(@user) do |f| %> <%= render 'shared/error_messages' %> <%= f.label :name %> <%= f.text_field :name %> <%= f.label :email %> <%= f.text_field :email %> <%= f.label :password %> <%= f.password_field :password %> <%= f.label :password_confirmation, "Confirm Password" %> <%= f.password_field :password_confirmation %> <%= f.submit "Save changes", class: "btn btn-large btn-primary" %> <% end %> <%= gravatar_for @user %> <a href="http://gravatar.com/emails">change</a> </div> here is the user_pages_spec: require 'spec_helper' describe "User pages" do subject { page } describe "profile page" do let(:user) { FactoryGirl.create(:user) } before { visit user_path(user) } it { should have_selector('h1', text: user.name) } it { should have_selector('title', text: user.name) } end describe "signup page" do before { visit signup_path } it { should have_selector('h1', text: 'Sign up') } it { should have_selector('title', text: full_title('Sign up')) } end describe "signup" do before { visit signup_path } describe "with invalid information" do it "should not create a user" do expect { click_button "Create my account" }.not_to change(User, :count) end describe "error messages" do before { click_button "Create my account" } it { should have_selector('title', text: 'Sign up') } it { should have_content('error') } end end describe "with valid information" do before do fill_in "Name", with: "Example User" fill_in "Email", with: "[email protected]" fill_in "Password", with: "foobar" fill_in "Confirmation", with: "foobar" end it "should create a user" do expect do click_button "Create my account" end.to change(User, :count).by(1) end describe "after saving the user" do before { click_button "Create my account" } let(:user) { User.find_by_email('[email protected]') } it { should have_selector('title', text: user.name) } it { should have_selector('div.alert.alert-success', text: 'Welcome') } it { should have_link('Sign out') } end end end describe "signup page" do before { visit signup_path } it { should have_selector('h1', text: 'Sign up') } it { should have_selector('title', text: full_title('Sign up')) } end describe "signup" do before { visit signup_path } let(:submit) { "Create my account" } describe "with invalid information" do it "should not create a user" do expect { click_button submit }.not_to change(User, :count) end end describe "with valid information" do before do fill_in "Name", with: "Example User" fill_in "Email", with: "[email protected]" fill_in "Password", with: "foobar" fill_in "Confirmation", with: "foobar" end it "should create a user" do expect { click_button submit }.to change(User, :count).by(1) end describe "edit" do let(:user) { FactoryGirl.create(:user) } before { visit edit_user_path(user) } describe "page" do it { should have_selector('h1', text: "Update your profile") } it { should have_selector('title', text: "Edit user") } it { should have_link('change', href: 'http://gravatar.com/emails') } end describe "with invalid information" do before { click_button "Save changes" } it { should have_content('error') } end end end end end edit: users_controllers.rb was formatted incorrectly. It should look like this: class UsersController < ApplicationController def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(params[:user]) if @user.save sign_in @user flash[:success] = "Welcome to the Sample App!" redirect_to @user else render 'new' end end def edit @user = User.find(params[:id]) end end

    Read the article

  • wait for ajax request then finish the rest ( jQuery )

    - by user1725155
    I have a peace of jquery code: var new = checkCP(somedata); if(new=="hi"){ alert("Welcom"); } function checkCP(jsData){ $.ajax({ type: "POST", url: "Process.php", data: jsData, dataType: "json", success: function(data){ if(data.match==1) return "hi"; else return "bye"; } }); } I don't know why the welcome alert never show up . I checked everything , even on PHP file the result is 1 but apparently before It wait for ajax respond it passes the if(new=="hi"){ alert("Welcom"); } So is there anyway to wait for ajax respond then read the rest of codes in jQuery ? Thanks.

    Read the article

  • Set the mouseover Attribute of a div using JQuery

    - by Abs
    Hello all, I would like to set an attribute for a div. I have done this: $('#row-img_1').onmouseover = function (){ alert('foo'); }; $('#row-img_2').onmouseout = function (){ alert('foo2'); }; However, the above has not worked, it does not alert when mouse is over or when it moves out. I have also tried the $('#row-img_1').attr(); and I could not get this to work either. I am aware that I should be using a more effective event handling system but my divs are dynamically generated. Plus this is a small project. ;) Thanks all for any help.

    Read the article

  • When iterating over values, why does typeof(value) return "string" when value is a number? Javascrip

    - by Mark
    I'm using Google Chrome for this test: Contrary to intuition, the first loop alerts "string" 3 times, while the second loop alerts "number" 3 times. numarray = [1, 2, 3]; //for-each loop for(num in numarray) alert(typeof(num)); //standard loop for(i=0; i<numarray.length; i++) alert(typeof(numarray[i])); I was expecting both loops to alert "number" 3 times. How is the first loop implemented in Javascript? In other words, if the for-each is syntactic sugar, what is its equivalent using a standard loop? Also, is there some way to iterate over an object's namespace using a standard loop? I'm looking to touch every one of some object's methods and attributes using a loop of the second kind. I'm new to Javascript and any help is highly appreciated, thanks.

    Read the article

  • Is it possible to access JSON properties with relative syntax when using JSON defined functions?

    - by Justin Vincent
    // JavaScript JSON var myCode = { message : "Hello World", helloWorld : function() { alert(this.message); } }; myCode.helloWorld(); The above JavaScript code will alert 'undefined'. To make it work for real the code would need to look like the following... (note the literal path to myCode.message) // JavaScript JSON var myCode = { message : "Hello World", helloWorld : function() { alert(myCode.message); } }; myCode.helloWorld(); My question is... if I declare functions using json in this way, is there some "relative" way to get access to myCode.message or is it only possible to do so using the literal namespace path myCode.message?

    Read the article

  • button click using jquery

    - by DotnetSparrow
    Hi All: I have an asp.net button on a page without masterpage like this: <asp:Button ID="target" runat="server" Text="Animate Me" > </asp:Button> and I am calling this: var panel = $('#<%= target.ClientID %>'); panel.click(function(){ alert($(this).attr("value")); }); but no alert is shown. I even tried this: $('#target').click(function(){ alert($(this).attr("value")); }); but It didnt work. Please suggest me how to click the button and what is issue in above code. Thanks.

    Read the article

  • Why can't I open a new window on my jquery ajax callback?

    - by KyleGobel
    to show my problem in a couple examples... THIS WORKS $.post("SomePage.aspx", { name : "value" }, function (data) { alert(data); }, "text"); THIS DOESN'T WORK $.post("SomePage.aspx", { name : "value" }, function (data) { window.open("http://www.google.com"); }, "text"); In the first example, I get alerted with what i'm expecting. In the second example, nothing happens. No window is opened. If I add an alert or something before or after the window.open call, the alert works fine, but the window doesn't open. If I add a window.open completly after the $.post method, the window opens fine (of course this doens't help me at all). I'm wondering why I can't open a window in the callback. What do I have to do to be able to open a window? I'd like to open a window to show some fancy results. Any help is appreciated, thanks.

    Read the article

  • This should be real easy. How to find a button through its Value (Jquery Selector)

    - by Raja
    I have this HTML: <div id='grid'> <input type="button" value="edit"/> <input type='button' value='update'/> </div> How to I attach a click event only to Update button. I know I could add a class to it or specity an id but both are not possible since it is in gridview. I tried this: $("input:button[@value='update']").click(function(){alert('test');}); but it displays an alert for both buttons. I know I must be doing something silly. Any help is much appreciated. Thanks Kobi for helping me out. Given below is the right answer. $("input[value='update']").click(function(){alert('test');});

    Read the article

  • jQuery .toggle() not working as expected with second function?!

    - by Christopher
    I'm trying to create a button to show / hide a div below it, all is working fine, I'm just struggling with the last bit! I need to distinguish wether it's a show or hide action so I can pass the variable elsewhere, here's what I have.. $(this).find('.hide-close').click( function() { $(this).siblings('.dragbox-content').toggle(function() { alert($(this).parent().attr("id") + ' Show'); },function() { alert($(this).parent().attr("id") + ' Hide'); } ); }) .end() }); If use the following code, taking out the second function within toggle(), it works?! But then I don't have a show / hide variable. $(this).find('.hide-close').click( function() { $(this).siblings('.dragbox-content').toggle(function() { alert($(this).parent().attr("id") + ' Show'); } ); }) .end() }); Thanks in advance for any help, hopefully it's something really simple I just can't see! :)

    Read the article

  • Javascript Regex Replace string, special character need help

    - by Mohummad Abdullah
    I am trying to replace string on page in runtime example: find string "(800).123.4567" to "<span>(800)123.4567</span>" means i want to add span tag before and after of string. here is i m doing this is my code: var avidno = '(800)123 1234'; function validate () { var regex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/; if (regex.test(avidno)) { alert('bingo'); var altrstr = '<span>'+avidno+'</span>'; alert(altrstr); // Valid international phone number } else { alert('uupss'); // Invalid international phone number } } validate();

    Read the article

  • the correct actionscript to find if object already exists

    - by touB
    I have a Rect object that I'd like to create and set its properties only once. After that, I want to just modify its properties since it already exists. This is my general idea if(theRect == undefined){ Alert.show("creating"); var theRect:Rect = new Rect(); //then set properties addElement(theRect); //then add it using addElement because addChild() does not work } else { Alert.show("updating"); //no need to create it since it's already been created //just access and change the properties } I tried several ways and combinations for the if conditional check: if(theRect == undefined){ if(theRect == null){ declaring and not declaring `var theRect:Rect;` before the if check declaring and instantiating to null before the if check `var theRect:Rect = null;` but can't get the desired effect. Everytime this code block runs, and depending on which version I've used, it either gives me a "can't access null object" error or the if statement always evaluates to true and creates a new Rect object and I get the "creating" Alert. What's the right way of creating that Rect but only if doesn't exist?

    Read the article

  • Providing updates during a long Rails controller action

    - by highBandWidth
    I have an action that takes a long time. I want to be able to provide updates during the process so the user is not confused as to whether he lost the connection or something. Can I do something like this: class HeavyLiftingController < ApplicationController def data_mine render_update :js=>"alert('Just starting!')" # do some complicated find etc. render_update :js=>"alert('Found the records!')" # do some processing ... render_update :js=>"alert('Done processig')" # send @results to view end end

    Read the article

  • Unable to capture the id of div clicked

    - by user3674364
    This is my jsfiddle http://jsfiddle.net/6TUtw/4/ How can i register for the event div click , so that i can get the name i have tried with different things , but none of them worked . $('#tabs div').click(function() { var elem = $(this); alert(elem); }); $('#tabs').on('click', 'div.click', function () { var elem = $(this); alert(elem); }); $("#tabs").click(function(){ var elem = $(this); alert(elem); });

    Read the article

  • greasemonkey code modification

    - by muqtar
    Hi,all.. A user has helped me find hidden values in a page and display it using alert. If there are radio buttons and one of them is related to this value,is there a way to select the radio button automatically rathar than displaying the value in alert box.. Thanks... the code is as follows: var inputs = document.getElementsByTagName('input'); for (i=0; i<inputs.length; i++) { if (inputs[i].getAttribute("name") == "ans") { alert(inputs[i].getAttribute("value")); } } this "value" must be selected in the radio button rathar than alerting...

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >