Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium







JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.

Share tech news, updates, or what's on your mind.

Sign up to Post

So I am creating a recipe box but I have a problem with one of my inputs when I'm creating a recipe.

When I start to type in my input for recipe name I get the following error message: TypeError

This is my stateful component:
class RecipeBoxContainer extends React.Component {
  constructor(props) {
    this.state = {
      recipes: [
          name: "Tarator", 
          products: ["Kiselo mlqko", "Krastavici", "Chesan"] 
      productInputValues: [],
      recipeName: '',
      count: 1
    this.renderInputs = this.renderInputs.bind(this);
    this.addInput = this.addInput.bind(this);
    this.deleteRecipe = this.deleteRecipe.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleRecipeNameChange = this.handleRecipeNameChange.bind(this);

  handleChange(i, event) {
    let productInputValues = this.state.productInputValues.slice();
    productInputValues[i] = event.target.value;

    this.setState({ productInputValues });

  handleRecipeNameChange(event) {
      recipeName: event.target.value

  renderInputs() {
    let inputs = [];
    for (let i = 0; i < this.state.count; i++) {
        <div key={i}>
            value={this.state.productInputValues[i] || ""}
            onChange={this.handleChange.bind(this, i)}

Open in new window

Keep up with what's happening at Experts Exchange!
LVL 11
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

I was using the following code from an online course for React routing:

import { Router, Route, browserHistory } from 'react-router';

<Router history={browserHistory}>
	<Route path="/" component={App></Route>
	<Route path="/One" component={One}></Route>
	<Route path="/Two" component={Two}></Route>
</Router>, document.getElementById('root'));

Open in new window

It gave me a following error "'react-router' does not contain an export named 'browserHistory'."

I did some research and found that I was using React Router v4, and the above code was for v3, so i found that I should be using <BrowserRouter> instead of <Router> so I changed my code to:

import { BrowserRouter, Route, Switch } from 'react-router-dom';

  <BrowserRouter history={History}>

		<Route path="/" component={App}></Route>
		<Route path="/One" component={One}></Route>
		<Route path="/Two" component={Two}></Route>
		<Route path="*" component={NoMatch}></Route>
</BrowserRouter>, document.getElementById('root'));

Open in new window

Now the page loads without an error but if I use Developer tools, I can see a warning:

"Warning: <BrowserRouter> ignores the history prop. To use a custom history, use `import { Router }` instead of `import { BrowserRouter as Router }`."

Another issue is that <Route path="*" component="NoMatch}></Route> only supposed to load NoMatch component when no path specified in the router but it loads on every page, regardless.
Can anyone help figure out how can I fix the issues?
i have a problem
i just want to pass a variable in javascript to another php file here is my ajax code:
var gID=window.gorevid;
                  data: "a=" + gID,
                        alert('ID iletildi.');
                        window.location = "index.php?page=gorevYorumEkle";

and i retrieve it in another php file with it

$gID = $_POST["a"];

but always get an error :Notice: Undefined index: a in

please Help me:)
JavaScript code text file is attached.

Right now when clicked, or hit entered the results display on the same window. Would like the results to open in new window or tab.

I am writing some javascript tests and I would like to do the below using jQuery, $('.parent .child'); can someone assist?

"has at least 1 entry after loadFeed function is called"

it(".feed container has at least 1 entry", function(done) { 
       var numEntries = document.querySelector(".feed").getElementsByClassName("entry").length;   //use jquery parent/child here

Open in new window

Good day
I have no experience is javascript whatsoever (this is my first attempt)  but my aim is to run excel macros on our server from a web based environment . This will enable me to only give the user what I want him to see.
I am trying to use the office.js API calls to change a value in the spreadsheet containing the macro and a private sub will then run the macro based on the change which occured.
The code below which I have copied from Microsoft I get the error "office is not defined" when I am trying to run the javascript in the Chrome console.
I would also like to know how can I change the code in order for the macro which will always run on the server to execute from any webpage. In other words how do I define the workbook location dynamically?
Office.initialize = function (reason) {
    $(document).ready(function () {
        switch (reason) {
            case 'inserted': console.log('The add-in was just inserted.');
            case 'documentOpened': console.log('The add-in is already part of the document.');
Excel.run(function (context) {
    var sheet = context.workbook.worksheets.getItem("Run macro");

    var range = sheet.getRange("B2");
    range.values = [[ 1 ]];

    return context.sync();
All of the sudden I seem to be have errors on my page loading my background video.  When I check the console I get the below errors, does anybody know how to correct this??:

Uncaught TypeError: Cannot read property 'play' of undefined
    at HTMLDivElement.<anonymous> (custom.js:683)
    at HTMLDivElement.dispatch (jquery.js:3)
    at HTMLDivElement.r.handle (jquery.js:3)
    at Object.trigger (jquery.js:3)
    at Object.a.event.trigger (jquery-migrate.min.js:2)
    at HTMLDivElement.<anonymous> (jquery.js:3)
    at Function.each (jquery.js:2)
    at a.fn.init.each (jquery.js:2)
    at a.fn.init.trigger (jquery.js:3)
    at n (ext.js:1143)

Open in new window


This is the code in the custom.js file the error is referencing:

var video_bg_mod = { };

      if( utils.exists('video-bg')  )
             var h = win.obj.height();
             var w =   h / (h/win.obj.width())  * 1.13  ;

                    "height" : h,
                    "width" :w

   video_bg_mod[jQuery(this).find('video').attr('id')] =  new MediaElement(jQuery(this).find('video').attr('id'),
                            features : [] , 
                         videoWidth: '100%',
                          videoHeight: '100%',

Open in new window

Hi, Please see: https://techgardens.com/product-category/mrv  the customer wants me to change the wording on the button from Product Enquiry to Product Inquiry. I'm using plugin WooCommerce Email Inquiry & Cart Options LITE.

There doesn't seem to be a place in the settings to change that, but there must be some javascript somewhere?
message:"initialize is not a function"
name :"InvalidValueError"

Open in new window

Here is the code:

 <script type="text/javascript">

       $(function initialize(){
  var myLatlng = new google.maps.LatLng(<?php echo $lat_long?>);
  mapOptions = {
    zoom: 15,
    // center: new google.maps.LatLng(10.3313405, 123.8999516)
    center: myLatlng
  map = new google.maps.Map(document.getElementById('map'), mapOptions),
  marker = new google.maps.Marker({
    // position: new google.maps.LatLng(10.3313405, 123.8999516),
    position: myLatlng,
    map: map,
google.maps.event.addDomListener(window, 'load', initialize);


    include '../../Controller/dbconn.php';
   // if(isset($_GET["id"]))
    function map(){
     $myID= $_GET['id'];
  $db = con();

  $sql = "SELECT restaurant_addr FROM restaurants WHERE restaurant_id = $myID";
  $stmt = $db->prepare($sql);
  $row = $stmt->fetch(PDO::FETCH_ASSOC);

   $geocode = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($row['restaurant_addr']));
  $lat_long = get_object_vars(json_decode($geocode)); //Store values in variable

  $lat_long = $lat_long['results'][0]->geometry->location->lat . "," . $lat_long['results'][0]->geometry->location->lng;

    // map();

Open in new window

Can anyone please help or guide me on setting up  Angular  CLI  with Jenkins? I am  setting up  a Development environment for a new  Project
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I am using SharePoint 2013.  

I am using Handlebars to display my SharePoint list into a table, which works.  But when I try to turn it into a dataTable, it does not transform into a dataTable.  I was able to do it in jsFiddle and it works.  Can you see what I am doing wrong?  

<!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">

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Handlebar Js Template Starts Here --> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.min.js"></script>   
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://understandsp.com/spdev/SiteAssets/siteAdmins.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/css/jquery.dataTables.css" />
<script id="siteadmin-template" type="text/x-handlebars-template">
<table border=1 width="100%" id="example" class="display"> 
		<th>First Name</th>
		<th>Last Name</th>

Open in new window

Hi, I manage a WordPress website for a local motorcycle dealer and he'd like to integrate with iVendi's finance calculator widget.

All the calculator needs is a line of Javascript in order to generate the widget, with 3-4 fields pre-populated (e.g. URL, username, registration, mileage, value).

The widget works great when you manually paste the code in but I just wondered if it was possible to pre-populate the script based on the listings from the motorcycle's WooCommerce listing.

Below is an example of a sample script that works:

<script src="https://newvehicle.com/widgets/lib/finance-comparator/loader.js?username=www.motorcycledealerurl.co.uk&quoteeUid=UNIQUE-ID-STATIC-VALUE&class=Bike&condition=Used&vrm=AE60HDD&registrationDate=01/11/2010&capCode=&capId=&cashPrice=5295&vatIncluded=&currentOdometerReading=25897&vehicleImageUrl=http://www.motorcycledealerurl.co.uk/wp-content/uploads/2017/12/IMGP8321.jpg&cashDepositType=&cashDeposit=500&term=36&annualDistance=10000&dateOnForecourt=" async></script>

Open in new window

I need to have the following fields populated from the WooCommerce listing:


...ideally these need to be pre-populated for each motorcycle as opposed to manually typing these into the script each time...is this possible?

Thanks in advance!

I need to create check off forms on iPads which need a date/time stamp for each item when it complete.  

A process that would work is using Excel with a 3rd party keyboard app like "TextExpander" which would have a script to output the date/time in a cell.  However, Excel is cumbersome to use for some end users, so I was hoping I could create a solution using PDF files.

However, it seems like PDF files need JavaScript to run code in them that would output the current time stamp when a check off box is activated, and it seems like no JavaScript is supported in iOS PDF readers...is this true?  Any ideas or alternatives?

I have some code which pulls tweets from a database, removes any URLs and highlights the hashtag from the string.
I am getting an error on this 1 tweet, and im not sure how to fix it.

Hilarious!! “@kellyfurneaux: Which one is Jodie?! #Sony https://t.co/sAdxCv3bDe�

Open in new window

It appears to be the â character which is 3rd from the end, because when I remove that character it works

	String.prototype.parseURL = function() {
		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) {
			return url.link(url);
	data.text = (data.text.parseURL());

	data.text = data.text.replace(/(\#[a-zA-Z0-9\-\_]+)/g,"<span class='hashtag'> $1 </span>");

Open in new window

Console Error
Uncaught TypeError: Cannot read property 'parseURL' of null
    at createTweet (createTweet.js:8)
    at Object.<anonymous> (twitterwall.js:127)
    at Function.each (jquery-3.1.1.min.js:2)
    at appendTweets (twitterwall.js:109)
    at Object.success (twitterwall.js:77)
    at i (jquery-3.1.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-3.1.1.min.js:2)
    at A (jquery-3.1.1.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery-3.1.1.min.js:4)

Open in new window

Could someone help here??
I have the below HTML and would like to change the display to block whenever the 'Reply' div is clicked on each of the them.
The Idea is that I want the div to show when I click on the reply.
I'm currently using a function called showCmt(), and I tried to get IDs from the html to the javascript. Below also is my Javascript. The issue I have is that I don't know how to get it working. Please I need a heads-up.

<div id="cmtreply_35" style="float:right; color:gray; margin-top:-18px; cursor:pointer; margin-right:10px;" onclick="showCmt(this)">Reply</div>
<div id="cmtRsp_35" style="display:none;">Response to this comment is shown only here!</div>

<div id="cmtreply_36" style="float:right; color:gray; margin-top:-18px; cursor:pointer; margin-right:10px;" onclick="showCmt(this)">Reply</div>
<div id="cmtRsp_36" style="display:none;">Response to this comment is shown only here!</div>

<div id="cmtreply_37" style="float:right; color:gray; margin-top:-18px; cursor:pointer; margin-right:10px;" onclick="showCmt(this)">Reply</div>
<div id="cmtRsp_37" style="display:none;">Response to this comment is shown only here!</div>

Open in new window

function showCmt(shocmt) {
    $(document).ready(function() {
        var resp_id = shocmt.parentNode.nextSibling.id;
        resp_id.style.display = 'block';

Open in new window

I have a question about Java-Script and JSON. It looks like that JSON.parse in Java-Script has many problems with escaped strings.
Anybody knows a solution how to work in Java-Script with JSON strings that works everywhere but not in Java-Script?

[{"id_case":"589","body_case":"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"  xmlns:tns=\"http:\/\/kd.blum.com\/api?ws=1\"><soap:Body><tns:initiateCorpus><initiateCorpus><ruleset>MR_Ruleset_Placeholder<\/ruleset><\/initiateCorpus><\/tns:initiateCorpus><\/soap:Body><\/soap:Envelope>"},{"id_case":"590","body_case":"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"  xmlns:tns=\"http:\/\/\/api?ws=1\"><soap:Body><tns:addFront><addFront><corpus><id>MR17090144d5a674a762c4a1c7f8e2afa838cb0559ad1fe8dda2b<\/id><\/corpus><containerNumber>1.1.1<\/containerNumber><position>front<\/position><\/addFront><\/tns:addFront><\/soap:Body><\/soap:Envelope>"},{"id_case":"591","body_case":"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"  

Open in new window


I have a requirement to make a manual work to automation. Here is the complete details about the automation plan.

1. Need to prepare a Java script by combining the SQL db as back end. These JavaScript can be scheduled in a 15 minutes once.
Once this Job got scheduled, it will run the java script and get the details from the SQL database(Select script which is ready with me!)
2. My condition in the java code should if the customer Which we are passing having any values in that time frame, it should pick and prepare a spreadsheet if there is no transactions it can be ignored for that run.
3. Also another requirement is to pull the logs from the servers based on the customer ID passed in the code. If there is a way to do that. We can implement the same.

Please share your thoughts and suggestions if any.

With next code i am adding rectangles and text to canvas. And with each new element i would like to move existing elements to left. But next code is locating all objects to upper left corner.
What is wrong in next code?

 function createStatusF(){  
   statusName  = prompt("Enter staus name:", ""); 
   if (statusName=== null){
        modalStatus.style.display = "none";
  var rectStatus = new fabric.Rect({
  left: 10,
  top: 10,
  fill: 'rgba(0,0,0,0)',
  width: 50,
  height: 25,
  id :statusName+"Rect",  
  strokeWidth: 2,
  lockMovementY: true
   var statusText = new fabric.Text(statusName, {
   selectable :false,
   top: 18, 
   fontWeight: 'bold',
   fontSize: 14,
      lockMovementY: true
   var textWidth = ( statusText.clientWidth + 1);
         var objects1 = null;
      objects1 = canvas2.getObjects();
      for (var i = 0, len = objects1.length; i < len; i++) {
          var objectPosi= objects1[i].get('left');

Open in new window


I'm looking to extract the script of multiple web pages using VBA and paste it on an a current excel sheet. The URLs of these web pages will be fixed. My end product is the hyperlink URLs within these web pages. These hyperlinks will be updated from time to time, so I'm looking to automate the extraction of the script of the web pages. I already have the code to filter the specific hyperlinks I need from the entire webpage script. I'm using IE for this.  I have basic VBA knowledge so hoping you're able to suggest a code for this and be explicit in explanations! Thank you

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


I have this page http://kroweb.dk/gfdev/godser/godser.php

Everything is working nicely except for two things.

I would like to get the searchfield in focus when the page opens or is refreshed  - searchfield id is "input_1"

I need to get the Return key to perform the search as well as the Search button does. The search button ("Søg") works nicely, but the Return key return nothing and it seems thar it is actually resetting the page.

Hoping that somebody can guide me in the right direction I paste in a little code here below.

I have this form:
<form action=""  id="search2" form title="Skriv evt. bare en del af det sted du søger, eller brug % som jokertegn når du søger bredt. Hvis du søger eksakt skal du skrive det eksakte navn på det du søger" style="padding-top:10px; padding-bottom:10px;" method="POST" >

         <input type="search" id="input_1" placeholder= "Søg" style="width: 300px; height: 35px; border: 1px solid #666666;border-radius:2px;color:#666666; color: #9F5584; font-weight: ligther; font-size: 13px; padding-left:10px;" name="query"  />

         <input type="button" submit title="Klik her, eller tast Enter, for at aktivere søgningen." style="margin-left:15px; padding-right:10px;height:30px;font-family:arial; font-size: 12px; text-align:left; background-color:#cccccc; border: 2px solid #grey;border-radius:2px; color:black; background-color:#cccccc; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);" name="soeg" 

Open in new window

Hi, my first question on Experts-Exchange.
I'm managing files in dropbox with javascript using their API. I've created an object that reflects the file structure:

file_structure = {

Open in new window

I want a dynamic solution to access a variable within this structure when I have the location in the form of a string or array. For example, would it be possible to use:

var string_index = "folder1/folder2/files/hello.html"

Open in new window

To index that point of the object. Ideally, I'd like this method to allow me to have the ability to both refer to the value, and/or edit it if possible. I appreciate though that it may be necessary to have separate methods to access the value using the string vs. changing the value at the location within the object. The closest thing I've got so far is using eval, which would look like:

eval("var value_accessed = file_structure['"+string_index.replace("/"."']['")+"']")

Open in new window

After which value_accessed should equal the value at that point of the object.

Thanks in advance

what is difference between control shift L and call hierarchy(control+alt+H)  in eclipse debugging the code.
what are best debugging techniques or tips

please advise
I have a div tag that is heing opened in modal with a button click
<a onclick="ShowFilterPopUp()" role="button" id="add_staff">Filters</a>

Open in new window

I am running some code on a second button click (In the modal window)

It reloads a grid
That reload closes the window

When I add an export to File as part of the process
The file does export but the modal does not close.

I tried calling a second code from server side but the modal window still does not close.

        If chkACH.Checked = True Then
            ExportACH() - exports but modal window does not close
            ScriptManager.RegisterStartupScript(Me, [GetType](), "blah", "ShowFilterPopUpHide();", True)
        End If

Open in new window

        function ShowFilterPopUp() {

        function ShowFilterPopUpHide() {

Open in new window

I'm curious about how I might emulate what's currently going on with the Zillow homepage, .. where clicking on the different tabs both changes the background image, and also changes the appearance and behavior of the search form.


I'd like to try to implement something similar on a WordPress site, most likely using JQuery (though I'm not averse to using vanilla JavaScript). Does anyone here have any tips or some "quick start" code examples they could share with me?

By the way  .. it's not necessary that I change the page url when I click on the different tabs.  I'm just looking to modify the DOM.

- Yvan
I copied the code from an example online and included bootstrap 4 css, bootstrap js,  bootstrap.bundle.js and jquery. Looks like I got it all, but instead of displaying nice horizontal menu like in example, I am getting vertical menu on the right-hand side of the page. What am i doing wrong? It does work with Bottstrap 3.3.7 though. What can I change to get it to display correctly with Bootstrap 4?

  <nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Page 1</a></li>
      <li><a href="#">Page 2</a></li>
      <li><a href="#">Page 3</a></li>
<div class="container">
  <h3>Basic Navbar Example</h3>
  <p>A navigation bar is a navigation header that is placed at the top of the page.</p>

Open in new window







JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.