w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » JAVASCRIPT » Page 2
dijit dialog wont open in custom widget
Inside script.js change the code to this code require(["custom/MyWidget", "dojo/domReady!"], function(MyWidget) { var myWdg = new MyWidget({}); myWdg.myDialog.startup(); myWdg.myDialog.show(); }); Or try this plunkr plunker

Categories : Javascript

Save and retrive HTML and .aspx Webpage in Titanium SDK
Its Work fine. var xhr = Titanium.Network.createHTTPClient({ onload: function(e) { var returnValue = this.responseText; Ti.API.info(this.responseText); var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'file.html'); if(f.exists()==false) { Ti.API.info('false'); // you don't need to d

Categories : Javascript

Get id of table cell
Try: $("#chessboard td").on("click", function(cell){ alert(this.id); }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <table id="chessboard"> <tr> <td id="A8">A8</td> <td id="B8">B8</td> <td id="C8">C8</td> <tr> <tr> <td id="A7">A7

Categories : Javascript

Javascript stop animation when scrolling stops
You could use a timer as follows: var timer; $(window).scroll(function() { clearTimeout(timer); timer = setTimeout( refresh , 150 ); $('#square').animate({ top: '70px', queue: true, }, 900).animate({ top: '5px', queue: true }, 1000); }); var refresh = function () { // do stuff $('#square').stop().clearQueue(); }; FIDDLE Reference: j

Categories : Javascript

Angular BindOnce, what can prevent it to work?
I think the value not changing after the click, bcoz of the context of this is changed for the clickTest function Try the code below, hope it works var vm = this; vm.value = 'value'; vm.clickTest = function () { vm.value = 'changed'; }; return vm; And for the bindOnce, I don't think its possible to bind again after the value is changed in the controller, and for testing the code, we should

Categories : Javascript

Close Button in Alert not showing
After some research I found that when you have multiple times defined the 'alert' array and the close attribute the 'X' dissapear. I presume that this could happen because the boolean that define if it should be showed is changed after seeing multiple times the variable, is toggled. Thanks for your help :) I hope this help anyone.

Categories : Javascript

How to run a function before jQuery validate plugin does the validation?
Not entirely sure what you're asking, but if by "validation", you mean when the messages are displayed, you can use these callback functions to get out in front of those. The highlight and unhighlight callback functions toggle the error/valid classes on the input elements and labels. You can over-ride these to do whatever you want. The errorPlacement callback function is what places the message

Categories : Javascript

Javascript availability validation in PHP CodeIgniter framework
I think you have to change the echo statement value to 0/1 instead of no/yes. public function check_availability() { $category_name = $this->input->post('category_name'); $this->form_validation->set_rules('category_name', 'category_name', 'required|is_unique[tblitemcategories.category_name]'); if ($this->form_validation->run() == FALSE) { //user name is not

Categories : Javascript

Regular Expression for a REST endpoint
Your regex ^((?!-).)*$ is same as ^[^-]*$ that is match any charcater but not of - zero or more times. The reason for why your regex not matches this person/1234-5678-9123 is because it has - symbol. But person/123456789123 string isn't has - symbol, so this got matched. To match the string which has - between the numbers then you could try the below regex. ^.*?d+-d+.*$ OR ^(?=.*?-).+$ (?=

Categories : Javascript

JavaScript or JQuery: get innermost element on position
A keydown event does not provide properties like .pageX and .pageY, so you cannot apply those values on document.elementFromPoint(). You need to have an event listener on your window or document.body and provide the event data information to a more public context, so you can access that data in your keydown handler. Demo: http://jsfiddle.net/1ztf2p9b/

Categories : Javascript

Javascript confirm for asp:ButtonColumn
I solved it by having it recognize the text of the link to bring up the confirm() $('#dgStuff').click(function (e) { var txt = $(e.target).text(); if (txt == 'Done') { return confirm("Are you sure you want to continue?"); } else { } });

Categories : Javascript

How to create Master pages using Javascript
You don't really need to inject CSS in the head for it to style your page. I think you can just include the <link> tag anywhere in the DOM and it should work. However, if you must include it in the head, try this: function addcssfile(cssfile){ var head = document.head || document.getElementsByTagName('head')[0]; var s = document.createElement('link'); s.setAttribute('rel', 's

Categories : Javascript

Uncaught error angular adding more than 3 modules
your controller is dependent of 'starter.vuelo' module. See: .controller('CharterCtrl', function($scope, $stateParams, VueloService) { $scope.vuelos = VueloService.all(); }); So, when you declare you controller module, you should declare this dependency: angular.module('starter.controllers', ['starter.vuelo']) After doing that you can add back: angular.module('starter', ['ionic', 'starter.

Categories : Javascript

Text changed event supported in Fabric.js
Try this for text changed events for IText changes: canvas.on('text:changed', function(e) { console.log('text:changed', e.target, e); }); Or this for IText object changes: object.on('changed', function(e) { console.log('changed', object, e); });

Categories : Javascript

Jquery slimscroll doesn't hide
I have had the same issue and it's hard to believe what I found as a solution. Ready? Just remove the border on the container where you have applied the slimscroll. That fixed it. I haven't found it necessary to look into the code but I am sure there's an easy fix for this.

Categories : Javascript

org.mozilla.javascript.EcmaError: ReferenceError: "document" is not defined
Apparently all I needed was a try catch around the code: function loadScript(src,callback){ //Adds the google maps script to the head of the HTML try{ var script = document.createElement("script"); script.type = "text/javascript"; if(callback)script.onload=callback; document.getElementsByTagName("head")[0].appendChild(script); script.src = src; }catch(e){ a

Categories : Javascript

How do I disable all mouse events on the map (click, hover, etc)?
I tried this: jQuery('#vmap').vectorMap({ map: 'russia_en', // removed other declarations not needed in this example onRegionOver: function(event,code, region) { if (code) { event.preventDefault(); } } }); This prevents the mouseover event to do it's work on the map I loaded. If you add similar code for the other events you should be good.

Categories : Javascript

Stop Dynamic Table Resizing
If you give each td in your final column that has the header "modify" a class and then give that class a defined width of your choice. This should stop happening. The HTML/Browser is automatically stretching the TDs out to what it believes is even for the content within them. Adding or removing content from a td without a defined width will do this.

Categories : Javascript

Filtering out with Datatable.net
Since you're using version 1.10 of datatables, you can use the .column().search() function to filter a table based on column values. It must be used in conjunction with .draw() to update the table: testTable.column(2).search('Product A').draw(); See fiddle: http://jsfiddle.net/2wbh4n61/ Also see Datatables Example: http://www.datatables.net/examples/api/multi_filter.html Update: In order t

Categories : Javascript

classic asp code in .js file
A .js file would need to be entirely written in client side JS. The stuff inside <% %> is server side VBScript. As an external javascript file it's useless, but you could use it as a server side include in a .asp page, ie <script type="text/javascript"> <!--#include file ="yourfilename.js"--> </script> In this situation the extension of the include file doesn't matter, a

Categories : Javascript

HTML5 canvas touch panning/scrolling?
Sorry, I don't know the exact code required, but if anything, that's slightly better because then the final project is still your own code, and requires you to actually do some stuff yourself. Anyway, the basic idea would be this: var touching; setInterval(function(){ if (not user-touching-screen){ touching=0; } else { if (touching == 0){ touching = 1; ix = where-user-put

Categories : Javascript

Creating a parallax object prototype with jQuery and I keep getting undefined errors on jQuery functions
A couple of things I would do here (working fiddle http://jsfiddle.net/z8upoccm/2/): 1.) It seems that the function is initializing on your jquery object as expected, but then again on regular DOM elements. Only allow jquery elements to pass through. Object.prototype.parallax = function(userOptions){ if(!this.jquery) return false; 2.) You need units on your translate css property element.cs

Categories : Javascript

right way to modify d3.csv to lower case column names
You can use the accessor that d3.csv accepts to specify how you want the row data transformed. The function below takes an object and converts all of its properties to lowercase. The example uses d3.csv.parse() instead of d3.csv() because its more straightforward to demo here, but you can do the same thing with d3.csv(). Unfortunately, this function gets called for every row as opposed to once w

Categories : Javascript

How can i have an evaluation within a scope variable using ngRepeat?
Try this: <div ng-repeat="item in data"> <div ng-repeat="col in columns"> {{col(item)}} </div> </div> And update your columns to: $scope.columns = [ function(item) { return item.firstName + ' ' + item.lastName; } ];

Categories : Javascript

Why do checkbox property show as 'false' (not checked) when checked?
I'm not certain I understand your problem, but maybe this is because the server is treating the defaults on your check boxes differently. In your HTML, you have set the value properties for all the checkboxes to 1, but the value of a check box is not the same thing as the checked property of a checkbox. When you check these boxes you are changing the checked property from missing to true. Perhaps

Categories : Javascript

Image series bar
$(".coins").each(function(){ var $self = $(this); var applyCoins = function(){ $self.empty(); var coins = $self.data("coins"); for (var i=coins-1; i>=0; i--) { var $coin = $("<div></div>").addClass("coin").css("top", (i*20)+"px"); $self.append($coin); } }; $self.on("loadCoins", function(){

Categories : Javascript

Reading dynamic text from stop watch and inserting it back in a div
After experimenting some more i solved it by changing the variable. $(".masterobject").click(function() { $(this).addClass("clicked"); if ($(".masterobject").length == $(".clicked").length){ pause(); $("#success").show(); var recordtime = $("#yourtime").text(); $("#success").html("congratulations your time is" + recordtime) } full code http://

Categories : Javascript

Get value from select and compare with the DB to obtain a price
You are vulnerable to sql injection attacks. Sit back and relax - your problem will become moot when your server gets pwn3d. As well, your code is highly flawed: document.getElementById("ppu").value = "<?php $query->fetch_object(); ?>"; Your fetch call doesn't DO anything useful. fetch will RETURN an object, but since you don't capture that object or output it in any way, the DB row d

Categories : Javascript

JQuery not detecting dynamically added Anchor Tag with AJAX
First Id must be unique, As A. WolF says your HTML is invalid "P element cannot contains a SELECT element", and you need to use event delegation like: $(document).on('çlick', 'a', function(e){ console.log('click'); e.preventDefault(); $companyName = $('#comp_staff option:selected').text(); $companyId = $('#comp_staff option:selected').val();

Categories : Javascript

Gmail REST API - Mark message as read
Try adding ContentType = "application/json; charset=UTF-8" in the code. Also, check this link for the detail information on the error. Let me know if you still see the error.

Categories : Javascript

Working on some Javascript, worked before, changed it, Ctrl+Z'ed it back, stopped working
Correct your input, </input> doesn't exists: <input type="submit" onclick="getURL()"> You can do what you want like this: HTML: <div class="inputField_1"> <input id="urlInput" type="text"/><br> <input type="submit" id="submitUrl"/> </div> <div class="aboutTitleWrap"></div> JQUERY: $("#submitUrl").on("click", function(){ var

Categories : Javascript

OnClick Function which opens my dropdown box
The problem is your select does not have any options in it, therefore it cannot display any data when clicked. If you give your select options then you will be able to pick items. Look at this fiddle: http://jsfiddle.net/zndwsb12/

Categories : Javascript

bookshelf.js relationship hasMany error
I reference my models as strings, and use Bookshelf's registry plugin. var bookshelf = new Bookshelf( knex ); bookshelf.plugin( 'registry' ); Then I define and create a model: var userModel = /*do bookshelf things*/; bookshelf.model( 'User', userModel ); Then when I create a .hasMany, I use a string to reference. users: function() { return this.hasMany( 'User', 'roleId' ); },

Categories : Javascript

jqGrid - disabling inline dropdown on "edit" but not on "add"
The usage of inlineNav is a special case of inline editing, because editRow will be called. Starting with jqGrid 4.5.3 inline editing supports beforeEditRow and beforeAddRow callbacks which was introduced mostly to provide additional customization in case of usage inlineNav. The method beforeEditRow is more interesting, because it will be called in any way of calling editRow. Before providing an

Categories : Javascript

How to call url in jquery from anchor tag?
Did you try the following ? <a id="lp1" href="Music/Linkin_park.mp3">Play Linkin park</a> <a id="lp2" href="Music/Linkin_park2.mp3">Play Linkin park2</a> <a id="lp3" href="Music/Linkin_park3.mp3">Play Linkin park3</a> And then calling $("#lp1").click(); with a onClick() method for playing each song. Or maybe you looked for something like this : var songto

Categories : Javascript

To disable back button in popup window
My opinion is that ; you shouldn't do it because of causing bad user engagement. It also makes your page untrustable. But for chrome and firefox this should be work; Put This script on head of your page and change 'pagename' to your page name. <script type = "text/javascript" > history.pushState(null, null, 'pagename'); window.addEventListener('popstate', function(event) { hi

Categories : Javascript

Uncaught TypeError: Cannot read property 'lat' of null Exception
Something to try - compose waypts with oResponseData.reduce() as follows : var waypts = oResponseData.reduce(function(a, waypoint) { var lastpoint = a[a.length - 1]; if( !lastpoint || !waypoint.equals(lastpoint.location) ) { a.push({ location:waypoint, stopover:true }); } return a; }, []); This should be more reliable though I'm not sure if it will fix the problem. You c

Categories : Javascript

Which JS added inline styles?
If you are using chrome, you can right-click the DOM element you want to watch (in the element inspector of the dev tools), and select Break On - Attributes Modifications. That's about the closest solution I know of.

Categories : Javascript

changing colors of google bar chart and convert data into percentage
To get the colours you need to change your first line of the array: Change ['Year', 'Sales'], To: ['Year', 'Sales', { role: 'style' }], then each value add the colour to the end like: ['2004', 1000, 'blue'], ['2005', 1170, '#cccccc'], I think you will have to program the percentage yourself. Im looking to do the same and cant find any examples.

Categories : Javascript




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.