Click here to Skip to main content
15,884,099 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: JavaScript or TypeScript: which one to really dig into? Pin
Anjali Kapoor1-Aug-17 1:50
Anjali Kapoor1-Aug-17 1:50 
QuestionAngularJS: How to prove that service and factory is singleton Pin
Mou_kol12-Jun-17 22:29
Mou_kol12-Jun-17 22:29 
AnswerRe: AngularJS: How to prove that service and factory is singleton Pin
Afzaal Ahmad Zeeshan12-Jun-17 22:55
professionalAfzaal Ahmad Zeeshan12-Jun-17 22:55 
GeneralRe: AngularJS: How to prove that service and factory is singleton Pin
Mou_kol15-Jun-17 2:53
Mou_kol15-Jun-17 2:53 
QuestionHow do I define constructor in service and factory in Angular? Pin
Mou_kol12-Jun-17 3:37
Mou_kol12-Jun-17 3:37 
QuestionAngularJS: Why people prefer factory to share data between controllers Pin
Mou_kol12-Jun-17 3:36
Mou_kol12-Jun-17 3:36 
AnswerRe: AngularJS: Why people prefer factory to share data between controllers Pin
onelopez12-Jun-17 5:41
onelopez12-Jun-17 5:41 
QuestionHow to write the handler for buttons using JQUERY Pin
Alex Can Work2-Jun-17 7:20
Alex Can Work2-Jun-17 7:20 
Hello! )) I try to write handler for buttons in JS through CSS-selectors. But i meet with difficulties.


in case of links this code JQuery works fine:

JavaScript
$(document).ready(function() { // waiting for page loading
var steps = $("form").children(".step"); // find all steps of the form
$(steps[0]).show(); // show 1st step
var current_step = 0; // set the current step
$("a.next").click(function(){    // Event of link-click  "necxt step"
if (current_step == steps.length-2) { // checking -  will it the next step is last
$(this).hide(); // i hide the link "next step"
$("form input[type=submit]").show(); // show thge button "OK"
}
$("a.back").show(); // show the link "Back"
current_step++; // increase the counter of the current slide
changeStep(current_step); // change a step
});

$("a.back").click(function(){    // Click event on a small window

if (current_step == 1) { // checking -  will it the next step is last
$(this).hide(); // hide the link "back"
}

$("form input[type=submit]").hide(); // hide the button "OK"

$("a.next").show(); //hide the link "Next step"

current_step--; // increase the counter of the current slide

changeStep(current_step);// change a step

});

function changeStep(i) { // the function of step changing 

$(steps).hide(); // hide all steps

$(steps[i]).show(); // show the current

}

});


But i'd rather to prefer make this fuctionality for buttons - "Next" and "Back"

My HTML-code
HTML
<!DOCTYPE html>
<HTML xmlns="http://www.w3.org/1999/xhtml" >
<HEAD>
<META name="viewport" content="width=device-width charset=UTF-8" HTTP-EQUIV="Content-Type"/>   
<LINK rel="stylesheet" href="templates.css" type="text/css"/>
<SCRIPT type="text/javascript" src="jquery-3.2.1.js"></SCRIPT>
<SCRIPT type="text/javascript" src="steps_registration.js"></SCRIPT>
<TITLE>Page</TITLE>
</HEAD>

<BODY>
<FORM method="get" action="send.php">
<DIV class="step">
<P class="step">step 1</P>
<P>Name:<INPUT type="text" name="login" placeholder="Login"></P>
</DIV>
<DIV class="step">
<P class="step">step 2</P>
<P>Sourname:<INPUT type="text" name="sname" placeholder="Input sourname"></P>
</DIV>
<DIV class="step">
<P class="step">step 3</P>
<P>E-mail:<INPUT type="text" name="mail" placeholder="Input e-mail"></P>
</DIV>
<P class="talign">
<INPUT type="button" onClick="history.back();" value="Back" name="1">
<INPUT type="button" onClick="history.forward();" value="Next" name="2">
<a href="#" class="back">Back</A>
<a href="#" class="next">Next</A>
<INPUT type="submit" value="OK">
</P>
</FORM>
</BODY>
</HTML>



My CSS
CSS
body {
margin:0;
}
/* Общие стили закончилась */

form {
width:30%;
margin:0 auto;
}

form div.step {
display:none;
}

form div.step p.step{
text-align:center;
font-size:28px;
}

form div.step p{
}

form div.step p input{
float:right;
}


a.back {
display:none;
}

form input[type=submit] {
display:none;
}

a {
color:#006600;
text-decoration:none;
}

form p.talign{
text-align:center;
}

GeneralRe: How to write the handler for buttons using JQUERY Pin
ZurdoDev13-Jun-17 1:35
professionalZurdoDev13-Jun-17 1:35 
AnswerRe: How to write the handler for buttons using JQUERY Pin
John C Rayan19-Jun-17 3:51
professionalJohn C Rayan19-Jun-17 3:51 
AnswerRe: How to write the handler for buttons using JQUERY Pin
Member 1069738612-Sep-17 1:10
Member 1069738612-Sep-17 1:10 
GeneralIT developer for a bank needs opinions about my Javascript for online banking OTP Pin
ArtCollector31-May-17 7:31
ArtCollector31-May-17 7:31 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
OriginalGriff31-May-17 7:37
mveOriginalGriff31-May-17 7:37 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
F-ES Sitecore31-May-17 22:25
professionalF-ES Sitecore31-May-17 22:25 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
OriginalGriff31-May-17 22:48
mveOriginalGriff31-May-17 22:48 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
F-ES Sitecore31-May-17 22:27
professionalF-ES Sitecore31-May-17 22:27 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
OriginalGriff31-May-17 22:48
mveOriginalGriff31-May-17 22:48 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
OriginalGriff31-May-17 22:48
mveOriginalGriff31-May-17 22:48 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
Richard Deeming31-May-17 8:24
mveRichard Deeming31-May-17 8:24 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
Richard MacCutchan31-May-17 22:35
mveRichard MacCutchan31-May-17 22:35 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
OriginalGriff31-May-17 22:49
mveOriginalGriff31-May-17 22:49 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
Richard MacCutchan1-Jun-17 1:01
mveRichard MacCutchan1-Jun-17 1:01 
GeneralRe: IT developer for a bank needs opinions about my Javascript for online banking OTP Pin
OriginalGriff1-Jun-17 1:16
mveOriginalGriff1-Jun-17 1:16 
QuestionExport canvas.js chart to pdf and excel Pin
prog.sidra30-May-17 7:51
prog.sidra30-May-17 7:51 
QuestionRe: Export canvas.js chart to pdf and excel Pin
ZurdoDev30-May-17 8:10
professionalZurdoDev30-May-17 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.