[Solved] Add Hidden Input onCheck

To make it hidden just replace type=”text” with type=”hidden” 🙂 JQuery: <form id=”myForm”> <input onclick=”addRemoveHiddenInput(‘testId’, ‘testName’, ‘testValue’)” type=”checkbox” id=”mc” name=”paymentMethod” value=”Mastercard”><label for=”mc”> Mastercard</label> </form> <script> function addRemoveHiddenInput(id, name, value) { if ( $(‘#’ + id).length > 0 ) { $(‘#’ + id).remove(); } else { $(‘#myForm’).append(‘<input type=”text” name=”‘ + name + ‘” value=”‘ + value … Read more

[Solved] Ajax Doesn’t work in Chrome,Firefox, & Opera

I recommend to use jQuery or other framework, that will be always aware of all the browsers specific stuff. If you prefer to use native code, you will need some extra code. First, dont rely just in ActiveXObject(“Microsoft.XMLHTTP”); and XMLHttpRequest that probably wont be always available. instead of that, use: function GetXmlHttpObject(){ var xmlHttp=null; try … Read more

[Solved] CSS Circle without using background [closed]

Change background-image to background .myNewClass { background: url(http://static4.wikia.nocookie.net/__cb20131121214007/destinypedia/images/7/71/Information_Icon.svg) no-repeat; background-size:100%; } https://jsfiddle.net/rg991koa/21/ 0 solved CSS Circle without using background [closed]

[Solved] How to write OR in Javascript?

Simply use: if ( age == null || name == null ){ // do something } Although, if you’re simply testing to see if the variables have a value (and so are ‘falsey’ rather than equal to null) you could use instead: if ( !age || !name ){ // do something } References: Logical operators … Read more

[Solved] Datepicker validation 18 years of age [closed]

If you look down the demo page a bit, you’ll see a “Restricting Datepicker” section. Use the dropdown to specify the “Year dropdown shows last 20 years” demo , and hit view source: $(“#restricting”).datepicker({ yearRange: “-20:+0”, // this is the option you’re looking for showOn: “both”, buttonImage: “templates/images/calendar.gif”, buttonImageOnly: true }); You’ll want to do … Read more

[Solved] The event handler to select

DEMO HTML: <select id=”cd-dropdown” class=”cd-select”> <option value=”-1″ selected>Choose an animal</option> <option value=”1″ class=”icon-monkey”>Monkey</option> <option value=”2″ class=”icon-bear”>Bear</option> <option value=”3″ class=”icon-squirrel”>Squirrel</option> <option value=”4″ class=”icon-elephant”>Elephant</option> </select> <div id=”div1″ class=”animalDiv”>MONKEY</div> <div id=”div2″ class=”animalDiv”>BEAR</div> <div id=”div3″ class=”animalDiv”>SQUIRREL</div> <div id=”div4″ class=”animalDiv”>ELEPHANT</div> CSS: .animalDiv { display:none; } JS/jQuery: $(function() { $(‘#cd-dropdown’).dropdown({ gutter: 5, stack: false, delay: 100, slidingIn: 100, onOptionSelect: function(e) { … Read more

[Solved] Split javascript key value pair

A simple loop will do: var data = […]; // your object for(var result=[], i=0; i<data.length; i+=2) for(var p in data[i+1]) result.push({Id:data[i], Abbribute:p, AbbributeValue:data[i+1][p]}); return result; 1 solved Split javascript key value pair

[Solved] How to toggle css visibility with Javascript

Basically your Javascript could be shortened to: $(“.question”).click(function(argument) { $(this).parent().find(“.answer”).removeClass(“hideinit”).addClass(“display”); }); In order to make this work the only other thing you need to do is to make question a class rather than as an id. That looks like: <p class=”answer hideinit”>the answer</p> See the fiddle here Edit: Add Hide / Show To get this … Read more

[Solved] Javascript multiple OR in statement [duplicate]

What you’re actually looking for is a logical AND, which would ensure that every condition is met: if (bedroomNums != “0_0” && bedroomNums != “0_1” && bedroomNums != “0_2”) { // `bedroomNums` is not one of “0_0”, “0_1”, “0_2” } If one of these checks returns FALSE (that is, bedroomNums is set to one of … Read more

[Solved] Center 4 quadratic (1:1) divs in one big quadratic div? [closed]

Use CSS-Grid to make the grid layout with equal split body{ margin:0; } .parent{ position: fixed; height: calc(100% – 20px); width: calc(100% – 20px); background-color: green; display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px; padding: 10px; } .child{ background-color:white; } <div class=”parent”> <div class=”child”> </div> <div class=”child”> </div> <div class=”child”> </div> <div class=”child”> </div> </div> Flex … Read more

[Solved] How to convert a php array of objects to javascrript objects?

<?php $myVar = json_encode($myArray) ; ?> Then pass the variable to you javascript: <script type=”text/javascript”> var myJsVar = <?php echo $myvar; ?> </script> I do not know Morris charts.. but maybe you can add a service where you can grab dynamically the data from a distant server providing a data source in the config. In … Read more