The first time, the modal opens partially out of the window but if I close and open again it opens on the right position.
<div id="modal-scores-grade" class="ui modal hide" data-backdrop="static" data-keyboard="false">
<div class="header">Lançar nota</div>
<div id="revision_type1" ng-show="current_score_index == 1">
<div class="criteria-title">Critério 1</div>
<div class="ui divider"></div>
<div class="content wrapper-modal-grades">
<div class="field">
<label>
<input name="norma_culta_radio" ng-init="revision.pt_norma_culta = 0" ng-model="revision.pt_norma_culta" type="radio" value=0>
norma culta
</label>
</div>
<div class="ui divider"></div>
<div class="field">
<label>
<input name="norma_culta_radio" ng-model="revision.pt_norma_culta" type="radio" value=40>
norma culta 2
</label>
</div>
</div>
<div class="actions">
<div class="ui buttons">
<div class="ui button closeScoreModal" ng-click="closeScore()">Fechar</div>
<div class="ui positive button" ng-click="saveScore(2)">Salvar</div>
</div>
</div>
</div>
<div id="revision_type2" ng-show="current_score_index == 2">
<div class="header criteria-title">Critério 2</div>
<div class="ui divider"></div>
<div class="content wrapper-modal-grades">
<div class="field">
<label>
<input name="entendimento_radio" ng-init="revision.pt_entendimento = 0" ng-model="revision.pt_entendimento" type="radio" value="0">
entendimento
</label>
</div>
<div class="ui divider"></div>
<div class="field">
<label>
<input name="entendimento_radio" ng-model="revision.pt_entendimento" type="radio" value="40">
entendimento 2
</label>
</div>
</div>
<div class="actions">
<div class="ui buttons">
<div class="ui button closeScoreModal" ng-click="closeScore()">Fechar</div>
<div class="ui positive button" ng-click="saveScore(3)">Salvar e ir para Critério 3</div>
</div>
</div>
</div>
Related
This is my code. is there any other way?
$("._nf-short-ans").on("click", function(){
$(".nf-short-desc").removeClass("nf-hide");
$(".nf-main-c").addClass("nf-hide");
$(".nf-btn-opt").addClass("nf-hide");
$(".nf-para-c").addClass("nf-hide");
$(".nf-date-c").addClass("nf-hide");
$(".nf-time-c").addClass("nf-hide");
$(".nf-other-c").addClass("nf-hide");
});
$("._nf-para").on("click", function(){
$(".nf-para-c").removeClass("nf-hide");
$(".nf-main-c").addClass("nf-hide");
$(".nf-btn-opt").addClass("nf-hide");
$(".nf-short-desc").addClass("nf-hide");
$(".nf-date-c").addClass("nf-hide");
$(".nf-time-c").addClass("nf-hide");
$(".nf-other-c").addClass("nf-hide");
});
$("._nf-date").on("click", function(){
$(".nf-date-c").removeClass("nf-hide");
$(".nf-main-c").addClass("nf-hide");
$(".nf-btn-opt").addClass("nf-hide");
$(".nf-short-desc").addClass("nf-hide");
$(".nf-time-c").addClass("nf-hide");
$(".nf-para-c").addClass("nf-hide");
$(".nf-other-c").addClass("nf-hide");
});
$("._nf-time").on("click", function(){
$(".nf-time-c").removeClass("nf-hide");
$(".nf-main-c").addClass("nf-hide");
$(".nf-btn-opt").addClass("nf-hide");
$(".nf-short-desc").addClass("nf-hide");
$(".nf-para-c").addClass("nf-hide");
$(".nf-date-c").addClass("nf-hide");
$(".nf-other-c").addClass("nf-hide");
});
$("._nf-multi-choice, ._nf-checkbox").on("click", function(){
$(".nf-para-c").addClass("nf-hide");
$(".nf-main-c").removeClass("nf-hide");
$(".nf-other-c").removeClass("nf-hide");
$(".nf-btn-opt").removeClass("nf-hide");
$(".nf-short-desc").addClass("nf-hide");
$(".nf-date-c").addClass("nf-hide");
$(".nf-time-c").addClass("nf-hide");
});
.nf-hide {
display: none !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="row margin-top-10 data-c">
<div class="col col-12 child-centered nf-main-c nf-hide" id="nf_1">
<div class="rdo-wrapper fullwidth" id="opt_1">
<input id="rdo8" type="radio" name="sample4" class="rdo">
<label class="lbl-rdo fullwidth noah-forms-lbl nf-opt-lbl" for="rdo8">
<div class="col col-12">
<div class="nf-opt-c">
<div class="nf-input-opt">
<input type="text" name="" class="txtbox noah-forms-textbox nf-opt" value="Option 1">
<span></span>
</div>
<div class="nf-aImage-c">
<div class="nf-opt-icon _nf-aImage-opt"></div>
</div>
<div class="nf-close-c">
<div class="nf-opt-icon _nf-close-opt"></div>
</div>
</div>
</div>
</label>
</div>
</div>
<div class="col col-12 margin-top-10 nf-short-desc">
<div class="nf-short-desc-c">
<input type="text" name="" class="txtbox noah-forms-textbox" placeholder="Short answer text">
<span></span>
</div>
</div>
<div class="col col-12 margin-top-10 nf-para-c nf-hide">
<div class="nf-para-input">
<input type="text" name="" class="txtbox noah-forms-textbox" placeholder="Long answer text">
<span></span>
</div>
</div>
<div class="col col-12 margin-top-10 nf-date-c nf-hide">
<div class="nf-date-input">
<input type="date" name="" class="txtbox noah-forms-textbox" placeholder="Short answer text">
<span></span>
</div>
</div>
<div class="col col-12 margin-top-10 nf-time-c nf-hide">
<div class="nf-time-input">
<input type="time" name="" class="txtbox noah-forms-textbox" placeholder="Long answer text">
<span></span>
</div>
</div>
</div>
<div class="nf-dropdown">
<div class="nf-select-c">
<div class="nf-default-opt">
<div class="nf-li">
<div class="nf-opt" data-value="nf-multi">
<div class="nf-icon _nf-icon-chk"></div>
<div class="nf-p">Multiple Choice</div>
</div>
</div>
</div>
<div class="nf-opt-ul">
<div class="nf-li">
<div class="nf-opt _nf-short-ans" data-value="nf-short-ans">
<div class="nf-icon _nf-icon-s-ans"></div>
<div class="nf-p">Short Answer</div>
</div>
</div>
<div class="nf-li">
<div class="nf-opt _nf-para" data-value="nf-para">
<div class="nf-icon _nf-icon-para"></div>
<div class="nf-p">Paragraph</div>
</div>
</div>
<hr>
<div class="nf-li">
<div class="nf-opt _nf-multi-choice" data-value="nf-multi">
<div class="nf-icon _nf-icon-mchoice"></div>
<div class="nf-p">Multiple Choice</div>
</div>
</div>
<div class="nf-li">
<div class="nf-opt _nf-checkbox" data-value="nf-check">
<div class="nf-icon _nf-icon-checkbox"></div>
<div class="nf-p">CheckBoxes</div>
</div>
</div>
<hr>
<div class="nf-li">
<div class="nf-opt _nf-date" data-value="nf-date">
<div class="nf-icon _nf-icon-date"></div>
<div class="nf-p">Date</div>
</div>
</div>
<div class="nf-li">
<div class="nf-opt _nf-time" data-value="nf-time">
<div class="nf-icon _nf-icon-time"></div>
<div class="nf-p">Time</div>
</div>
</div>
</div>
</div>
</div>
The code works just fine. However, I'm thinking if there is a way to shorten this kind of jQuery code.
Rather than giving the containers a unique class, such as .nf-date-c, you can give them all a common class, like .nf-container, then use that as the selector. Since you're already storing which container the option relates to in it's data-value, you can use that to select the corresponding container.
<div class="col col-12 margin-top-10 nf-date nf-container">
$('.nf-opt').on('click', function(){
$('.nf-container').addClass('nf-hide'); //hide everything
$('.nf-container.' + this.getAttribute('data-value'))
.removeClass('nf-hide'); //unhide the clicked option
});
If you put the toggleable elements (that get shown or hidden) in order, you can iterate over the clickable .nf-lis and use the clicked index to identify which toggleable section to show, and hide the rest.
Your toggleable sections are already in order except for the .nf-main-c - all you need to do in the HTML is move that to the end so it comes last with the .data-c > div selector.
const toggleableDivs = $('.data-c > div');
$('.nf-li').each(function(i) {
$(this).on('click', () => {
toggleableDivs.addClass('nf-hide');
toggleableDivs.eq(i).removeClass('nf-hide');
});
});
.nf-hide {
display: none !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="row margin-top-10 data-c">
<div class="col col-12 margin-top-10 nf-short-desc">
<div class="nf-short-desc-c">
<input type="text" name="" class="txtbox noah-forms-textbox" placeholder="Short answer text">
<span></span>
</div>
</div>
<div class="col col-12 margin-top-10 nf-para-c nf-hide">
<div class="nf-para-input">
<input type="text" name="" class="txtbox noah-forms-textbox" placeholder="Long answer text">
<span></span>
</div>
</div>
<div class="col col-12 margin-top-10 nf-date-c nf-hide">
<div class="nf-date-input">
<input type="date" name="" class="txtbox noah-forms-textbox" placeholder="Short answer text">
<span></span>
</div>
</div>
<div class="col col-12 margin-top-10 nf-time-c nf-hide">
<div class="nf-time-input">
<input type="time" name="" class="txtbox noah-forms-textbox" placeholder="Long answer text">
<span></span>
</div>
</div>
<div class="col col-12 child-centered nf-main-c nf-hide" id="nf_1">
<div class="rdo-wrapper fullwidth" id="opt_1">
<input id="rdo8" type="radio" name="sample4" class="rdo">
<label class="lbl-rdo fullwidth noah-forms-lbl nf-opt-lbl" for="rdo8">
<div class="col col-12">
<div class="nf-opt-c">
<div class="nf-input-opt">
<input type="text" name="" class="txtbox noah-forms-textbox nf-opt" value="Option 1">
<span></span>
</div>
<div class="nf-aImage-c">
<div class="nf-opt-icon _nf-aImage-opt"></div>
</div>
<div class="nf-close-c">
<div class="nf-opt-icon _nf-close-opt"></div>
</div>
</div>
</div>
</label>
</div>
</div>
</div>
<div class="nf-dropdown">
<div class="nf-select-c">
<div class="nf-default-opt">
<div class="nf-li">
<div class="nf-opt" data-value="nf-multi">
<div class="nf-icon _nf-icon-chk"></div>
<div class="nf-p">Multiple Choice</div>
</div>
</div>
</div>
<div class="nf-opt-ul">
<div class="nf-li">
<div class="nf-opt _nf-short-ans" data-value="nf-short-ans">
<div class="nf-icon _nf-icon-s-ans"></div>
<div class="nf-p">Short Answer</div>
</div>
</div>
<div class="nf-li">
<div class="nf-opt _nf-para" data-value="nf-para">
<div class="nf-icon _nf-icon-para"></div>
<div class="nf-p">Paragraph</div>
</div>
</div>
<hr>
<div class="nf-li">
<div class="nf-opt _nf-multi-choice" data-value="nf-multi">
<div class="nf-icon _nf-icon-mchoice"></div>
<div class="nf-p">Multiple Choice</div>
</div>
</div>
<div class="nf-li">
<div class="nf-opt _nf-checkbox" data-value="nf-check">
<div class="nf-icon _nf-icon-checkbox"></div>
<div class="nf-p">CheckBoxes</div>
</div>
</div>
<hr>
<div class="nf-li">
<div class="nf-opt _nf-date" data-value="nf-date">
<div class="nf-icon _nf-icon-date"></div>
<div class="nf-p">Date</div>
</div>
</div>
<div class="nf-li">
<div class="nf-opt _nf-time" data-value="nf-time">
<div class="nf-icon _nf-icon-time"></div>
<div class="nf-p">Time</div>
</div>
</div>
</div>
</div>
</div>
I want to be able to check if the input is checked and if it is checked then grab the data associated with that input and display it into another div. here is my code.
var levels = $('input:checked + label').map(function() {
return $(this).text();
}).get();
//alert(levels);
document.getElementById('listprice').innerHTML = levels;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row sln-service sln-service--3181">
<div class="col-md-12">
<div class="row sln-steps-info sln-service-info">
<div class="col-xs-2 col-sm-1 sln-checkbox sln-steps-check sln-service-check">
<div class="sln-checkbox">
<input type="checkbox" name="sln[services][3181]" id="sln_services_3181" value="1" data-price="175" data-duration="180">
<label for="sln_services_3181"></label>
</div>
</div>
<div class="col-xs-10 col-sm-8">
<label for="sln_services_3181">
<h3 class="sln-steps-name sln-service-name">Service Title</h3> <!-- collect this -->
</label>
</div>
<div class="col-xs-2 visible-xs-block"></div>
<h3 class="col-xs-10 col-sm-3 sln-steps-price sln-service-price">$175</h3> <!-- collect this -->
</div>
<div class="row sln-steps-description sln-service-description">
<div class="col-md-12"><hr></div>
<div class="col-sm-1 hidden-xs"> </div>
<div class="col-sm-10 col-md-9">
<label for="sln_services_3181">
<p></p>
<span class="sln-steps-duration sln-service-duration"><small>Duration:</small> 03:00</span> <!-- collect this -->
</label>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-11">
<span class="errors-area" data-class="sln-alert sln-alert-medium sln-alert--problem">
<div class="sln-alert sln-alert-medium sln-alert--problem" style="display: none" id="availabilityerror">
Not enough time for this service
</div>
</span>
</div>
</div>
</div>
<div class="demo">
You are booking a
<div id="listprice">
<!-- display collected here -->
</div>
</div>
I would like to collect the data and show it back in a div somewhere else on the page. Any jquery to help achieve this would be great.
$(document).ready(function(){
var checkedItems = $('input[type=checkbox]:checked');
checkedItems.each(function(){
var serviceName = $(this).parents('.sln-service-info').find('.sln-service-name').html();
var servicePrice = $(this).parents('.sln-service-info').find('.sln-service-price').html();
$('#listprice').append('<div>Title - '+serviceName +' Price - ' +servicePrice +'</div>');
});
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row sln-service sln-service--3181">
<div class="col-md-12">
<div class="row sln-steps-info sln-service-info">
<div class="col-xs-2 col-sm-1 sln-checkbox sln-steps-check sln-service-check">
<div class="sln-checkbox">
<input type="checkbox" checked name="sln[services][3181]" id="sln_services_3181" value="1" data-price="175" data-duration="180">
<label for="sln_services_3181"></label>
</div>
</div>
<div class="col-xs-10 col-sm-8">
<label for="sln_services_3181">
<h3 class="sln-steps-name sln-service-name">Service Title</h3> <!-- collect this-->
</label>
</div>
<div class="col-xs-2 visible-xs-block"></div>
<h3 class="col-xs-10 col-sm-3 sln-steps-price sln-service-price">$175</h3> <!-- collect this -->
</div>
<div class="row sln-steps-description sln-service-description">
<div class="col-md-12"><hr></div>
<div class="col-sm-1 hidden-xs"> </div>
<div class="col-sm-10 col-md-9">
<label for="sln_services_3181">
<p></p>
<span class="sln-steps-duration sln-service-duration"><small>Duration:</small> 03:00</span> <!-- collect this -->
</label>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="demo">
You are booking a
<div id="listprice">
<!-- display collected here -->
</div>
</div>
Hello fellow internet strangers :) If any of you has some time to spare and knows Semantic UI I'd apreciate some help...
I'm building a form and on large screens it looks perfect...
but the problem ocures when I start displaying it on smaler screens... the elements start ovelaping each other like on the two images bellow:
My HTML code is:
<h1>Računi (2017)</h1>
<div class="ui form" style="padding: 20px">
<div class="ui stackable equal width grid">
<div class="row">
<div class="column">
<div class="field">
<label>Št. računa</label>
<div class="ui left icon input">
<input type="text" name="racun_id" placeholder="št. računa">
<i class="hashtag icon"></i>
</div>z
</div>
</div>
<div class="column">
<div class="field">
<label>Ime in priimek</label>
<div class="ui left icon input">
<input type="text" placeholder="Vnesi...">
<i class="user icon"></i>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label>Naslov</label>
<div class="ui left icon input">
<input type="text" name="kupec_naslov" placeholder="Vnesi...">
<i class="marker icon"></i>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label>Začetni datum</label>
<div class="ui left icon right labeled input">
<i class="calendar icon"></i>
<input type="text" name="zac" value="14.9">
<div class="ui basic label">
2017
</div>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label>Končni datum</label>
<div class="ui left icon right labeled input">
<i class="calendar icon"></i>
<input type="text" name="kon" value="14.9">
<div class="ui basic label">
2017
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="column">
<div class="field">
<label>Referent</label>
<div class="ui selection dropdown">
<input type="hidden" name="referent_id">
<i class="dropdown icon"></i>
<div class="default text">Izberi...</div>
<div class="menu">
<div class="item" data-value="1">Male</div>
<div class="item" data-value="0">Female</div>
<div class="item" data-value="1">Spaceman</div>
<div class="item" data-value="0">Spiderman</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label>Odprt račun</label>
<select class="ui dropdown">
<option value="">--</option>
<option value="N">Odprt TRR</option>
<option value="C">Odprt Plačilna kartica</option>
</select>
</div>
</div>
<div class="column">
<div class="field">
<label>Filter plačilnih kartic</label>
<div class="ui selection dropdown">
<i class="payment icon"></i>
<input type="hidden" name="referent_id">
<i class="dropdown icon"></i>
<div class="default text">Izberi...</div>
<div class="menu">
<div class="item" data-value="">--</div>
<div class="item" data-value="isicvisa">ISIC Visa</div>
<div class="item" data-value="maestro">Maestro / BA</div>
<div class="item" data-value="visa">Visa</div>
<div class="item" data-value="mc">MasterCard</div>
<div class="item" data-value="karanta">Karanta</div>
<div class="item" data-value="diners">Diners</div>
<div class="item" data-value="amex">American Express</div>
</div>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label>Zaključeni odprti računi</label>
<div class="ui slider checkbox">
<input type="checkbox" name="newsletter">
<label> </label>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label>Izpiši račune:</label>
<button class="fluid ui primary button"><i class="terminal icon"></i>Izpis</button>
</div>
</div>
</div>
</div>
</div>
BTW I havent written any of my own CSS... using purely the Semantic one
So if anyone has a solution to this or if anyone sees a problem in my code id apreciate some help :)
P.S. Sorry for bad english... it's not my native language
Don't use grids. Stick with the multiple field classes that semantic ui provides.
Semantic-UI multiple fields in forms
<div class="ui form">
<div class="three fields">
<div class="field">
<label>First name</label>
<input type="text" placeholder="First Name">
</div>
<div class="field">
<label>Middle name</label>
<input type="text" placeholder="Middle Name">
</div>
<div class="field">
<label>Last name</label>
<input type="text" placeholder="Last Name">
</div>
</div>
</div>
This bit me too but make sure you have
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> in your header.
Source: https://github.com/Semantic-Org/Semantic-UI/issues/3152
I had this problem, and with all the changes suggested here, the problem still persisted exclusively for the dropdown fields.
The solution for me was to change <select name="name" class="ui dropdown"> to <select name="name" class="ui dropdown fluid"> (adding the fluid class). This prevented the dropdown from jumping over the other fields, as in OP's example.
The structure of the HTML was the same as in the #VtoCorleone's answer, and the dropdown was previously initialized with $(".ui.dropdown").dropdown().
I have some radio buttons and I am adding checked attribute to selected radio button but having one problem. I want to remove checked="checked" attribute from radio button which selected.
HTML Code:
<div class="tabtwo-info">
<div class="tab-two">
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Unsecured Loans
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Secured 2nd Charge Lending
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Overdrafts
</div>
</div>
</a>
</div>
<div class="seperator">
<div class="container">
<div class="row"> <span class="sep"></span>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Trade Finance
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Business Cash Advance
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Working Capital
</div>
</div>
</a>
</div>
<div class="seperator">
<div class="container">
<div class="row"> <span class="sep"></span>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Stock Finance
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 "> <a class="brokersector" href="javascript:void(0);">
<input type="radio" value="" id="" name="brokersector">
<div class="image-cat-box">
<div class="image-box">
</div>
<div class="title-cat">
Acquisition Finance
</div>
</div>
</a>
</div>
<div class="seperator">
<div class="container">
<div class="row"> <span class="sep"></span>
</div>
</div>
</div>
</div>
</div>
jQuery Code:
$(".tabtwo-info .brokersector").click(function () {
$(this).find('input:radio').attr('checked', true);
});
My JSFiddle: https://jsfiddle.net/jj57q8fs/
JSFiddle Screenshot:
To force a remove of the attribute, before checking a new:
$(".brokersector").click(function () {
$('input[type=radio]').removeAttr('checked');
$(this).find('input[type=radio]').attr('checked', 'checked');
});
This will force an removal of all checked on any radio button, before a new radio is set. The selector can be more specific of course, like in Idir's example.
Also, #Regent posted a fiddle using prop instead. I would suggest you use this, as it states in the documentation:
Nevertheless, the most important concept to remember about the checked attribute is that it does not correspond to the checked property. The attribute actually corresponds to the defaultChecked property and should be used only to set the initial value of the checkbox. The checked attribute value does not change with the state of the checkbox, while the checked property does.
try this,
$(".tabtwo-info .brokersector").click(function() {
$('input[name=brokersector]').removeAttr('checked');
$(this).find('input:radio').attr('checked', 'checked');
});
I agree with [Rory McCrossan][1], you don't need jQuery for that. but here is what you can do this:
$('input[name=brokersector]:checked').removeAttr('checked');
$(".tabtwo-info .brokersector").click(function () {
$("input:radio").removeAttr("checked");
$(this).find('input:radio').attr('checked', true);
});
});
I`m use front-end framework Foundation. How i can in this menu enable Log in button only if Login and Password input filled text.
<form data-abide="ajax">
<div class="row">
<div class="large-12 columns">
<input type="text" placeholder="Login" />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input type="text" placeholder="Password" />
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
Log in
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
<br />Register
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
<br />Forgot password?
</div>
</div>
</form>
You could add a function to watch the onkeypress listener for the input box. Here is a working fiddle of how to do it on the username and you could do something similar for the password input as well.
http://jsfiddle.net/fFLq4/
Add a couple element id's to your elements:
<form data-abide="ajax">
<div class="row">
<div class="large-12 columns">
<input type="text" id="loginTxtBox" placeholder="Login" />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input type="text" placeholder="Password" />
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
Log in
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
<br />Register
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
<br />Forgot password?
</div>
</div>
</form>
And add the javascript function to listen for the keypress:
var textBox = document.getElementById("loginTxtBox");
textBox.onkeypress=function(textBox){
if(this.value.length >= 5)
{
document.getElementById("loginButton").className = "button tiny";
}
else
{
document.getElementById("loginButton").className = "button tiny disabled";
}
};
This will only activate your login button once you have at least 5 characters in it. Apply this to your password input as well.
If I understand this correctly, you would like to show the login form only if the user clicks on the Login Link.
To achieve this, I would suggest moving the links outside the and use any of these (toggle/show/slide) in jQuery to show it on click.
Here is the modified HTML:
<form id="loginForm" data-abide="ajax">
<div class="row">
<div class="large-12 columns">
<input type="text" placeholder="Login" />
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input type="text" placeholder="Password" />
</div>
</div>
</form>
<div class="row">
<div class="large-12 columns text-center">
<a id="login" href="#" class="button tiny disabled">Log in</a>
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
<br />Register
</div>
</div>
<div class="row">
<div class="large-12 columns text-center">
<br />Forgot password?
</div>
</div>
And here is a working fiddle of how to show/hide the login form:
http://jsfiddle.net/9C4s7/
The commented line in the js toggles the slide (clicking the link will show the form, clicking it again will hide it). The active line will only make it slide down once clicked. So, you go ahead and choose whichever works best for you!