Toggle button if checkbox is check [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I made a sign up form and i want to allow user to press the create account button only if he check the checkbox and if not the button is unclickable.The form looks like this:
<input type="text" name="nume" value="" placeholder="Nume" /><br />
<input type="text" name="prenume" value="" placeholder="Prenume" /><br />
<input type="text" name="username" value="" placeholder="Username" /><br />
<input type="password" name="password1" value="" placeholder="Parola" /><br />
<input type="email" name="email1" value="" placeholder="E-mail" /><br />
<input type="checkbox" name="reguli" id="reguli" required >
<label for="reguli">I agree with the website rules</label><br />
<input type="submit" name="cont" value="Creare cont" />
Found what I search : Toggle Button

Give id to your button like
<input type="submit" name="cont" id="btnsubmit" disabled="true" value="Creare cont" />
Then add following code to your javascript and you are done
$("#reguli").change(function(){
$("#btnsubmit").prop("disabled",!this.checked);
});
Fiddle here

use the jquery validate plugin
$('#signup form').validate({
rules: {
reguli: {
required: true,
}}});

Related

Text ID = Password... will not work? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
The password input isn't working... check it:
<div class="form">
<h2>Login Form</h2><br />
<form method="POST" id="login-form">
<input type="text" id="username" name="username" placeholder="Username">
<input type="text" id="password" name="password" placeholder="Password">
<input type="submit" value="Login">
</form>
I apologize for being unclear.
Thanks!
You are missing type here. To get password field,Input type should be password
Try like this
<input type="password" id="password" name="password" placeholder="Password">
Add type="password" instead of type="text". See demo

How to link another page using button? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have used a template from the web for a Login page, and I am not able to figure out how can I link this page to another when one clicks the 'Login' button. I have no knowledge of HTML and CSS or JS , so if anybody can guide me through this I'll be grateful.Its for a college project that has to be submitted tomorrow. Its not that I don't want to learn, but there was something else I was working on which didn't work out pretty well so I had to start this and I have only a day.
I was unable to paste the code here. SO here's the link : http://pastebin.com/pPS0Np8A
<input type="button" value="click" onclick="window.open("http://www.google.com/"); window.open("http://www.youtube.com/");" />
If it's just a Link when pressing the button, put an <a>-tag around your button and the LInk inside the href attribute:
<p><input type="submit" value="Sign In"></p>
using harshit's solution i added the id to restore css properties but if the css value is a class rather than an id just replace id= with class=.
<input type="button" value="click" id="myCssClassId" onclick="window.open("http://www.google.com/"); window.open("http://www.youtube.com/");" />
So you were "not able to figure out how can I link this page to another when one clicks the 'Login' button".
Simplified from the login-page you provided, you have the following code:
<form action="Default5.aspx" method="POST">
<fieldset>
<p><label for="email">E-mail address</label></p>
<p><input type="email"
id="email"
value="mail#address.com"
required="required" />
</p>
<p><label for="password">Password</label></p>
<p><input type="password"
id="password"
value="password" />
</p>
<p><input type="submit" value="Login" /></p>
</fieldset>
</form>
Now, note the <input type="submit" value="Login" />. Once you'll click that, the form will submit the data contained in it (the password and email).
When you submit a form, the form needs an address where it needs to send the data to. This is then also the page that is displayed ('redirected'). You set this simply with the form's action attribute, which is just an URL.
Just wanted to rectify this for future readers.
EDIT:
So, for example an exact image-search on google could work like:
<form method="GET"
action="http://www.google.com/search"
target="_BLANK"
onsubmit="var e = this.getElementsByTagName('input');
e[1].value= 'isz:ex,iszw:' + e[3].value
+ ',iszh:' + e[4].value;
return true;
"
><fieldset>
<input type="hidden" name="tbm" value="isch" />
<input type="hidden" id="tbs" name="tbs" />
<p>Search Image:
<input type="text" name="q" value="search" />
</p>
<p>
Width: <input type="text" value="32" /> px <br />
Height: <input type="text" value="32" /> px <br />
<input type="submit" value="Search" />
</p>
</fieldset>
</form>
Example jsFiddle here
Here the method is changed from POST to GET. That way the values entered in the form are appended to the URL (so anyone can read them).
To close with a final example of how to open a new blank page I added the target-attribute, and pointed it to _BLANK.
The example's are intentionally kept simple, style and expand on them as you wish.

change the style of only the element that was clicked? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Hi guys I have been making this form that has different inputs but they all have the same class:
<input type="text" name="username" class="field" />
<input type="text" name="email" calss="field" />
what i want to do is when ever the input filed is clicked i want to change the border color with JQuery(only the element that is clicked not all at the same time)
any one got an idea?
<input type="text" name="username" class="field" />
<input type="text" name="email" calss="field" />
$('.field').click(function(){
$(this).css('attributeName','value'); //here $(this) represents current element.
});
Bind a click event to all inputs, then use $(this) to target the one that was actually clicked .
$('.field').on('click', function() {
$('.field').removeClass('clicked'); // Remove previous
var $this = $(this);
$this.addClass('clicked'); // If you want to add the CSS with a class, which i recommend.
$this.css('border', '[css-border-values]'); // Inline CSS
});
<input type="text" name="username" class="field" />
<input type="text" name="email" calss="field" />
$('input[type=text]').focus(function(){
$('input[type=text]').css({'border':''});
$(this).css({'border':'solid 2px #ccc'});
});
http://jsfiddle.net/jCpfH/

how to check html5 form validity with vanilla javascript? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
HTML:
<form id="myform" method="post">
<input name="email" type="email" required=""/>
<input name="fname" type="text" required="" />
<input name="zip" type="text" />
<input type="button" value="button" />
</form>
Here I want to just check email by applying javascript function for html5 can we do that?
Edit
It has been unclear/misunderstood before. My question is do we have boolean valid check like form.email.valid() so that we can do check for email only with using javascript?
You should change your button input. A HTML5 submit button needs to look like the following:
<button type="submit">Submit</button>
Also, giving your e-mail a placeholder would be nice:
<input name="email" type="email" placeholder="me#example.com" required=""/>
Example jsFiddle.

How to make my eBay search bar specific to my store? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I have recently re-designed the look of my company's eBay store, and have put a custom search bar in place. However, when my user's search for a product, it is not searching for products in my store in particular. Instead, it is doing a general eBay search.
I have included my full code in a JSFiddle for you helpful people to check out, and would really appreciate it if anyone can tell me how to make it so it searches only for products in my store in particular.
Thanks in advance:
JS FIDDLE: http://jsfiddle.net/DanCUK89/U6LqJ/
<form name="search" method="get"
action="http://search.stores.ebay.com/search/search.dll?GetResult&">
<input type="text" name="query" maxlength="300" >
<input type="hidden" name="fcd" value="2">
<input type="hidden" name="from" value="R10">
<input type="hidden" name="sasel" value="<Your store number>">
<input name="submit" type="submit" value="Search">
<br />
<input type="checkbox" name="srchdesc" value="y">search titles & descriptions
</form>
or try this
<form name="search" method="get" action="http://search.stores.ebay.com/search/search.dll">
Search Our Store:
<input type="text" name="query" size="7">
<input type="submit" value="Go" width="20" height="16" border="0">
<input type="hidden" name="MfcISAPICommand" value="GetResult">
<input type="hidden" name="sid" value="ENTER STORE ID HERE">
<input type="hidden" name="store" value="ENTER STORE NAME HERE">
<input type="hidden" name="colorid" value="15">
<input type="hidden" name="fp" value="0">
<input type="hidden" name="srchdesc" value="y">
</form>
use:
"/your _store/_i.html
on form acion like this:
<form action="/your_store/_i.html">
your_store is the liunk to your store like this:
stores.ebay.com/your_store

Categories

Resources