w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » JAVASCRIPT » Page 1
jquery table filter removing too much data
It looks like you need to only get the text of the element and none of the children tags when you're doing your search. A quick search of SO gives this They suggest doing this: $("#foo") .clone() //clone the element .children() //select all the children .remove() //remove all the children .end() //again go back to selected element .text(); For your code it would be so

Categories : Javascript

Javascript object bracket notation on left side to assign
It's called destructuring assignment and it's part of the ES2015 standard. The destructuring assignment syntax is a JavaScript expression that makes it possible to extract data from arrays or objects using a syntax that mirrors the construction of array and object literals. Source: Destructuring assignment reference on MDN Object destructuring var o = {p: 42, q: true}; var {p, q}

Categories : Javascript

Javascript on screen calculations from select / radio box
The selector you are using is wrong since "party" is the name of the select and not the ID. $(document).on('change', '#party', function(e) { Change your select element to <select id="party" value="<?php echo $party;?>"> and change the id of your span below to something else. Same thing applies to your VIP input.

Categories : Javascript

Marionette.js CompositeView - How to render model and collection without nesting
First of all you should attach views to the DOM. Errors occur, because child views rendered before they are attached to the DOM. You can override some methods to solve the problem. That will do the trick: EmailView = Marionette.CompositeView.extend({ className: function () { return this.model.isThread() ? 'thread' : null; }, initialize: function (options) { this.c

Categories : Javascript

How to play multiple mp3 files with Jplayer?
this is easy without anchoring with jquery attr. <a href="#" music-url="songs_music_url">This is song 1</a> In jquery: myPlaylist.add({ title:"<Song name>", artist:"<singer name>", mp3:$('a').attr('music-url'), });

Categories : Javascript

JS function not being called?
You should delete code window.onload= "loadQuestion1()" from h3 tag and add onload= "loadQuestion1()" to body tag. This should work. This is working code, you had also few syntax error in JS, please compare with your code <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body onload="loadQuestion1()">

Categories : Javascript

Access to info in DOM Created from AJAX
You're appending your result straight to the div, so my guess is the browser renders this as html but jquery sees it as a string, and not the individual elements. If your controller method returns a string, this is probably the case.

Categories : Javascript

Changing a Table Row's colour onload
You have used: '<tr id="row'. $row['id'] .'">' but var rowId = check_array[i].value; document.getElementById(rowId).style.color = "#4D4A49"; is using the value attribute from the checkboxes which are set to: value="' . $row['id'] . '" hence either change: document.getElementById('row' + rowId).style.color = "#4D4A49"; or '<input name="checkbox[]" type="checkbox" id="checkbo

Categories : Javascript

Wordpress ajax call is returning an entire page of html
It will return all contents from the page rendered at your url "location.href" Try adding a exit() to your php code to stop it after your echo. <?php if(isset($_POST['Action'])) { $Action = $_POST['Action']; if($Action == "refresh-cart") { echo '<div id="stuff"><p> done LOL </p></div>'; exit; } } ?> <div>html content here will no

Categories : Javascript

textarea mouseup Event only fires once
This code causes that function to be executed once, the first time the mouseup event is fired: onmouseup="myfunction()" This code on the other hand, assigns myfunction as the event handler for the mouseup event, so it will be called each time the event is fired. onmouseup="myfunction"

Categories : Javascript

Generate components in sub-folders in ember/ember-cli
As the assertion suggests this is due to Handlebars 1.x, and will be available soon. Ember 1.9 beta builds currently support this, though I'm not positive if ember-cli's resolver would work with it right now. You can read more about Handlebars 2.0 here. Using a pods structure will also help with organization, and I believe is going to be the recommended strategy going forward. For now, I'd sugg

Categories : Javascript

Scale image using jQuery Slider not positioning correctly
while calculating nx and ny do not add or remove wd/hd. This will solve your problem if (zv < 1){ nx = (ixz); ny = (iyz); $('#img1').css({'left':nx+'px','top':ny+'px'}); } else { nx = (ixz); ny = (iyz); $('#img1').css({'left':nx+'px','top':ny+'px'}); }

Categories : Javascript

How to format an image and vcard when using foundation accordion list
As bigbobr stated the below should work. <img style="width:304px;height:228px;float:right;" src="http://thumb9.shutterstock.com/display_pic_with_logo/1294/108451796/stock-photo-friendly-male-doctor-at-the-gym-smiling-108451796.jpg" alt="PCP">

Categories : Javascript

Chrome won't stop caching scripts, even when caching disabled
You can usually force the browser to load a fresh copy of a URL by making it "new" using something like a new parameter value in the URL. Example: <script type="text/javascript"> var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.setAttribute("src", "yourfile.js?random=" + new Date()); document.getElementsByTagName("head")[0].appendChild(s

Categories : Javascript

Unusual behaviour resulting from JQuery bind( )
You're using .bind(), but that does, as you theorized, bind the click event to the entire container. Just change that .bind to .on and your event delegation should work.

Categories : Javascript

Javascript rating scale of 1-10 is not displaying proper 'if/else' response
A few things wrong with your code: if (feedback == 10) { console.log("Thank you! We should race at the next concert!"); } else if (feedback <=8) { console.log("I'll keep practicing coding and racing."); } When you use a single = it is assigning the value 10 to the variable feedback instead of checking for equality. The value you assign to feedback then passes through and is evaluate

Categories : Javascript

Can you hook "low level" calls in javascript so that you can log execution?
You can override host/native objects just like user-land objects. var $ = document.querySelectorAll; document.querySelectorAll = function () { console.log('Selecting elements', arguments); return $.apply(document, arguments); }; Simply putting this snippet in a content script wouldn't work as content scripts run in an isolate scope and any variables set by them are not visible to other sc

Categories : Javascript

Encode an image from a URL to Base64 without a canvas
A canvas doesn't hold (for example) a jpg. A jpg is lossy. When you load it into canvas, it gets 'unpacked'. When you use a built-in canvas method to output a dataURL, it will first re-compress the raw canvas-data (32 bit per pixel inc alpha) to the (lossy-level depending on internal paramaters) format you have chosen as output, then convert that data to base64. What I'm trying to say here is, th

Categories : Javascript

MySQL Array to Javascript
I'd recommend reading about JSON. It's a JavaScript "array" that many other languages can encode and decode. with PHP $myjson = json_encode($myarray, JSON_FORCE_OBJECT); then <script> var myjson = <?php echo $myjson; ?>; </script>

Categories : Javascript

JavaScript addEventListener only for outerDiv
You may want to check out JQuery for your solution. Try something like: $("#deneme").click(function(){ alert("The div was clicked." /* Or do something else */); }); Also there may be a similar question here: addEventListener vs onclick

Categories : Javascript

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




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