JavaScript

120K

Solutions

41K

Contributors

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

Hi all,
Im using Jquery and Bootstrap.

Very simple test set up. I have a page which opens a remote content modal.

In the modal there is a div I wanted updated depending on whats in the select box. At the moment nothing seems to happen, Im guessing this is to do with the way Im initalizing the Jquery functions (ie. the elements dont exist on the page until the initial modal call). Any ideas how to solve this?



This is the page:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>


<script>
$(document).ready(function(){
    $("button").click(function(){
        $("#thisone").replaceWith("Hello world!");
    });
    
    $("#selector" ).change(function() {

if($("#selector").val()=="one") {
	$("#question").load("text1.txt");
} else if($("#selector").val()=="two") {
	$("#question").load("text2.txt");
}


});
});

</script>
</head>
<body>
<a class="btn btn-lg btn-success" data-toggle="modal" data-target="#basicModal"  href="modal.html">Click to open Modal</a>
   



<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">

Open in new window

0
What does it mean to be "Always On"?
LVL 4
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Hi experts, I wish to put some colspan in a table created from server side as a response of a certain request. My code below is trying to implement such thing but it does not work. Any help please!

         response.write("<tr>")
            response.write("<th style="" width: 170px; color: black; padding: 1px; text-align: center; colspan: 2; "">" & "Date executed" & "</th>")
            
            
            response.write("<th style=""width: 130px; padding: 3px; color: black; "">" & "Notes" & "</th>")

         response.write("</tr>")

Open in new window

0
I am in development of Delivery Challan Module., @ which i got struck is

when i enter my invoice_no(in textbox) it should fetch datas from db and displays. This is what i was looking for.,
whereas in this i use two tables invoiceinfo & invoice_details

i have already got infos from invoiceinfo(table) which means when i enter the invoice_no it will fetch some details such like customer details etc.,

but @invoice_details alone i cant get details.,

actually i had interconnected both  invoiceinfo & invoice_details for delete & update purposes!

I used this code but doesnt works


$select_productdetail_query = "SELECT * FROM invoice_details WHERE invoiceinfo_id='".$_REQUEST['invoice_no']."'";

$productdetail_query_result = mysqli_query($connection, $select_productdetail_query);      

while($productdetailview = mysqli_fetch_array($productdetail_query_result)){
<?php //echo $productdetailview['product_code']; ?>
                                                 <td><strong><small><?php echo $productdetailview['product_code']; ?></strong></small> </td>
                                 <td style="text-align:left;"><strong><small><?php echo $productdetailview['product_name']; ?></strong></small></td>
                                                 <td><strong><small><?php echo $productdetailview['product_quantity']; ?></strong></small></td>
                                                 <td><strong><small><?php echo $productdetailview['product_price']; ?></strong></small></td>
                                 <td><strong><small><?php echo $productdetailview['total_price']; …
0
Hi there,
I need to create a website for a charity and am looking for suggestions on existing frameworks to use.  The system should
support  users to register and login through a web portal.  

The basic operations is that the admin will add a list of activities in a main List.  A user can check-out these activities from the main list or the admin can assign an activity to a member.

1. User registration mechanism
2. Admin dashboard/user dashboard

I am looking for a PHP/Javascript - MySQL based system.  Can you suggest any frameworks that I can customize easily.
Thank you
0
I just tried to zoom in and the right hand side "hero board" overlapped 1/2 of the screen, making the main area completely inaccessible.

Not only main area of the site is illegible, even scroll bar is available,

Any chance at the least to get a horizontal scroll bar "in"?
0
need a datagrid with horizontal and vertical scrol, the header fixed and and also 2 columns!

You guys
0
I have a form where the user sets a few decimal fields and if the user tabs through the fields the 'total' field calculates all the fields together and gets set and everything works fine but if they use their mouse this is where my troubles begin. I know it is because of the keyup in my function but I wanted to know if there is something else that I can use like something similar to onblur() maybe? I am new to javascript and jquery so I have no clue so any advice would be great.

Here is my code...
<%--Being used for generating Travel item cost values for the Total--%>
<script type="text/javascript">
    $(document).ready(function () {
        $(".toCalculate").keyup(function () {
            var total = 0;
            $(".toCalculate").each(function (index, item) {
                temp = parseFloat($(item).val());                
                if (isNaN(temp))
                    temp = 0;
                total = total + temp;
            });
            $(".total").val(total.toFixed(2));            
        });
    });
</script>

Open in new window


Thanks for the help!!!
0
I have a select input on a page and I want the user to select an option. When they select an option, I coded it where they will be forwarded to another page with a different form. I would like to carry over their selection to the "value" of an input field in the new form. Can someone help me execute this? I'm assuming it can be done somehow with javascript but not sure how.

This is the select button code on the first page:
<select type="text" class="service-list form-control" data-placeholder="Select Option" onchange="location = this.value;">
	<option value="new-form.html">Apple</option>
	<option value="new-form.html">Orange</option>
	<option value="new-form.html">Watermelon</option>
</select>

Open in new window


This is the input code on the page the user is forwarded to. Let's assume the user selected the "Orange" option in the above example.
<div class="form-group">
	<input class="form-control" name="option" id="option" type="text" value="Orange" disabled>
</div>

Open in new window

0
I had this question after viewing asp.net repeater modal & data command.
0
What is the best method to get SharePoint list items from Office Web Addin using the credentials of the logon user?

We have migrated to Office 365, I am not sure whether i must authenticate on AD or Office 365, the Office Addin App will be deployed on SharePoint on Premise

I have tried rest services but I am not sure of how to pass the user token, for authentication.

   function GetSharePointListItems() {
        $.ajax({
            url: "weburl/_api/web/lists/getbytitle('listname')/Items?$select=Title,ParagraphText&$filter=ParagraphText isnotnull ",
            type: "GET",
            Authorization: {"Bearer " + accessToken},
             headers: { "accept": "application/json;odata=verbose" },
            success: function (data) {
                if (data.d.results) {
                       OnSuccessSharePointData();
                }
            },
            error: function (xhr) {
                alert(xhr.status + ': ' + xhr.statusText);
                OnErrorSharePointData();

            }
        });
any ides
0
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!

This is my main.html codeThis is my main.html codeThis is my insert.php codeAnd this is the error which always arises whenver i use localhostHi There I have been getting this issue lately. I don't know where this error come from. Whenever I use my localhost(Obviously i need it for my php files to run) this error arises in console

Error in response to storage.get: SyntaxError: Unexpected token <
    at Object.callback (chrome-extension://nkeimhogjdpnpccoofpliimaahmaaome/js/content.js:1:50)
    at chrome-extension://nkeimhogjdpnpccoofpliimaahmaaome/js/content.js:1:22

This error occurs for all files which i open using localhost.But when I used without localhost ie simply open the html file it works just fine.
Currently I'm learning Angular.js
Here I want to insert data in database using ANGULAR & PHP
0
CppComet
CppComet is open source comet server. In this article i tell about CppComet features and will show an example of a chat on PHP and CppComet.
0
Thank you for looking at my question,

I think it's fair to say I'm not really sure what I'm doing, but having read some stuff on here and from other sources I've cobbled this together - it doesn't work, can anybody help me put it right.

I have a php form with three input boxes main, rtd and combined (mimics production paperwork). I want, as the user tabs away from main or rtd, to sum the values of main and rtd and display the result in combined - I'm sure this is possible  I just don't know how to achieve it.


								echo '<table>';
									echo '<tr>';
										echo '<td colspan="4">Strain Gauge Before Stretching</td>';
										echo '<td>MT Strain Gauge</td>';
										echo '<td align="center">Main</br><input type="text" id="main" OnChange="jsCalculate()"/>&Omega</td>';
									echo '</tr>';
									echo '<tr>';
										echo '<td>MT Strain Gauge RTD</td>';
										echo '<td align="center"><input type="text" id="rtd" OnChange="jsCalculate()"/>&Omega</td>';
										echo '<td align="center">Combined</br><input type="text" id="combined"/>&Omega</td>';
									echo '</tr>';
								echo '</table>';
							echo '</td>';
							echo '<td width="50%" align="center">';
							echo '</td>';
						echo '</tr>';
					echo '</table>';
				echo '</td>';
			echo '</tr>';
		echo ' </table>';
	}
?>
<script language="javascript">
	function jsCalculate(){
		var SGMain = document.getElementbyid("prestretchmain").value;
		var SGRTD = 

Open in new window

0
Need to prevent google developer tools explore my page, is any way to achive that,
dont want to see my html page code and nothing
regards dear experts
0
Hi all,

I'm trying to create a Google Sheet that will automatically create Home/Away game matchups given some user-provided parameters:

Total teams: 8 (Lions, Tigers, Bears, ...). This number can vary.
Total games played per team: 10 (5 Home / 5 Away if possible. This number can vary.

I need the best possible diversity in terms of matchups.

I'm hoping the Google Sheet can kick out a simple columnar schedule like the following.

 Screen Grab
Can this be done without Javascript?

Thanks in advance.
0
Hi all,

I'm trying to convert an Excel macro to work in Google Sheets. I have neither Excel VBA nor Javascript skills, so I'm hoping someone can help.

Here is the original Excel macro code:

===========================
Sub RoundRobin()
    Dim x, y, Counted, Number
    Set wsSheet3 = ThisWorkbook.Worksheets("Sheet1")
   
    Number = wsSheet3.Range("B2").Value
    x = wsSheet3.Range("A" & Rows.Count).End(xlUp).Row
    For Each c In wsSheet3.Range(wsSheet3.Range("A2"), wsSheet3.Range("A" & Rows.Count).End(xlUp))
        Counted = 1
        y = wsSheet3.Range("D" & Rows.Count).End(xlUp).Row
        For i = 2 To x Step 1
            If c.Value <> wsSheet3.Range("A" & i).Value And Counted <= Number / 2 Then
                wsSheet3.Range("D" & y + Counted).Value = c.Value
                wsSheet3.Range("E" & y + Counted).Value = wsSheet3.Range("A" & i).Value
                Counted = Counted + 1
            ElseIf c.Value <> wsSheet3.Range("A" & i).Value And Counted <= Number Then
                wsSheet3.Range("E" & y + Counted).Value = c.Value
                wsSheet3.Range("D" & y + Counted).Value = wsSheet3.Range("A" & i).Value
                Counted = Counted + 1
            End If
        Next i
    Next
End Sub
===========================

I need to convert that to Javacript that can be fired off in Google Sheets. Can someone help?

Thanks in advance.
0
Perhaps I am over-thinking this but what I need to do is see what the time difference it is from the start session time (1 minute) subtracting the current time.
<script type="text/javascript">
var mySessionTimer;

@functions {        
    public int PopupShowDelay
    {
        get {
            DateTime currentSetTimeout = DateTime.Now.AddMinutes(HttpContext.Current.Session.Timeout);
            DateTime currentServerTime = DateTime.Now;
            TimeSpan duration = (currentServerTime.Subtract(currentSetTimeout));

            return 60000 * (int)duration.TotalMinutes;
        }
    }
}

function callJSSessionTimer() {
    var sessionTimeoutWarning = @PopupShowDelay;
    var sTimeout = parseInt(sessionTimeoutWarning);

    mySessionTimer = setTimeout('SessionEnd()', sTimeout);
}

function SessionEnd() {
    clearTimeout(mySessionTimer);
    window.location = "/Account/sessionover";
}

@if (userInfo != null)
{
    if (userInfo.chosenAMT == "True")
    {
        @:callJSSessionTimer();
    } else
    {
        @:clearTimeout(mySessionTimer);
    }
} else {
    @:clearTimeout(mySessionTimer);
}
</script>

Open in new window

So for the value for duration is -00:01:00 which technically is correct since currentSetTimeout is 1 minute and it gets todays date/time which is a minute away since its subtracting it fromcurrentSetTimeout.

So the point of all of this is to keep track of the remaining session time when the user jumps from page to page. Currently when the user goes to another page, it resets the time and its not accurate.

How can I go about doing this the way I need it?
0
Hi E's,
I Have 3 buttons and a Materialize Modal that contains a HTML Select with Four options to choose from. 0 by default and 1, 2, and 3, and each number between 1 to 3 are associated to each button.
The objective is, when I click in any button, open the Modal and change the select view for the correspondent number.
I try change the selected with jQuery in this way:
$("#numbers[value=3]").attr("selected", "selected");
but not work.
In attach image you can see what appear regardless of which button I click.Modal view
<!DOCTYPE html>
 <html>
   <head>
     <!--Import Google Icon Font-->
     <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
     <!--Import materialize.css-->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css">
     <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
   </head>
   <body>
<a class="waves-effect waves-light btn b1">button one</a>
<a class="waves-effect waves-light btn b2">button two</a>
<a class="waves-effect waves-light btn b3">button 333</a>

<!-- Modal Structure -->
  <div id="modal1" class="modal">
    <div class="modal-content">
      <h4>Header</h4>
  <div class="input-field col s12">
  <select id="numbers">
    <option value="0" selected>Choose your number</option>
    <option value="1">one</option>
    <option value="2">two</option>
    <option value="3">3333</option>
  </select>
  

Open in new window

0
I have a Single Page App and I want to scroll to another section from a link on my landing page to another section.  What in your opinion is the best way to do that with current technology?  Javascritpt, Jquery, Other??  And how.
0
Get 15 Days FREE Full-Featured Trial
LVL 1
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

I updated node and npm and now yo is not working. I installed it in many ways including sudo npm install -g yo.

It does install and runs the yo doctor. Everything checks out. But when I type yo doctor, it says

-bash: yo: command not found

Im wondering if it has to do with my path and node. I even tried to brew link node and have done many steps. Not sure what else to do so asking the experts!

Thank you all.
0
Hi all, I need to start an aspx page with a modal window if a codebehind query condition is true,
how to achive that dear experts!!!
0
3
 
LVL 1

Expert Comment

by:Juana Villa
Mind blowing!
0
I am trying to convert an @Html.Textbox image button to a submit button with  the onclick calling a Javascript function.

Here's what I have:
@Html.TextBox("Next", null, new {type = "image", src = @Url.Content("../App_Themes/icons/button_next.png"), @class = "imgbottom", onclick = "javascript: ValidateSelection ($(\"[name$='selectedItems']:checked\"))"})

Here's what I've tried:
<input type="button" value="Next" onclick="ValidateSelection (selectedItems.checked)">

and my Javascript function:
function ValidateSelection(item) {
    if (item == null || item.length == 0) {

        var validationSummary = $('.validation-summary-errors ul');
        if (validationSummary.length > 0 && $('.validation-summary-errors ul li').length == 0) {
            validationSummary.append('<li>' + "Please select at least one item" + '</li>');
        }
        var errors = $("[name='ErrorMessage']");
        if (errors.length > 0) {
            errors.hide();
        }
        var buttonGenerateReport = $("#GenerateReport");
        if (buttonGenerateReport.length > 0) {
            buttonGenerateReport.hide();
        }
        event.preventDefault();
    }
}
0
Hi Guys,
I send json data from my server to the view in MVC project.

Here is the link I send as a json:
dataCell.textCell = "<a onmouseout='HideFlyOut()' ;="" class='theme_color' onmouseover='ShowFlyOut('" + encryptedRowPass + "') href=\documentviewer.aspx?" + encryptedValue + "'<i class='fa fa-paperclip fa-flip-horizontal fa-2x theme_color'></i></a>"

Open in new window



Now in my UI side I'm getting this data which is one row and parse it to json:

 var sendDataRowsToView = JSON.parse(datarows)

Open in new window


Then I"m trying to place this data into a <td> in my dom:

 tableBody.append('<td> + sendDataRowsToView + </td>')

Open in new window



I'm getting the data and all works fine but it doesn't bind it to the dom:

Like I'm expecting to see for exmaple:
<td><a></a></td> which bind all the link from the server, but for some reason I can't see this data in my dom.

what am I doing wrong?
0
Hi,

Am newbie to wordpress,I need to Attached image in the portofolio page Show Slider in Single page Content using Nice Portofolio plugin.Is Working good category Wise Once Clicked that category Attached images show slider.Please give me solution for my Problem.
I need to use Slider using Jquery.Is it possible to Show Slider using Js inside Nice Portofolio Plugin.
0

JavaScript

120K

Solutions

41K

Contributors

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.