[Solved] toggle function not working with jquery 1.9 [duplicate]

from jquery 1.9 docs .toggle(function, function, … ) removed This is the “click an element to run the specified functions” signature of .toggle(). It should not be confused with the “change the visibility of an element” of .toggle() which is not deprecated. The former is being removed to reduce confusion and improve the potential for … Read more

[Solved] Duplicate contents of a TD [closed]

One way: $(“button”).click(function() { copy(); }); function copy() { $(‘tr’).each(function() { $(this).find(‘td :input:not(:first)’).val($(this).find(‘td :input:first’).val()).prop(‘checked’, $(this).find(‘td :input:first’).prop(‘checked’)) }) } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script> <table> <tr> <td> <input type=”text” value=”abc” /> </td> <td> <input type=”text” value=”def” /> </td> <td> <input type=”text” value=”ghi” /> </td> </tr> <tr> <td> <select> <option> 123 </option> <option selected=”selected”> 456 </option> <option> 789 </option> </select> … Read more

[Solved] JSON Object to Jquery select array [closed]

You can use Array.prototype.map() function. var o = {“tuple”:[{“old”:{“MST_VAS_TYPE”:{“MST_VAS_TYPE_ID”:”VAS_1000″,”VAS_TYPE_NAME”:”AMC”,”VAS_TYPE_DESC”:”Annual Maintenance Contract”,”CREATED_ON”:null,”CREATED_BY”:null,”MODIFIED_ON”:null,”MODIFIED_BY”:null,”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”}},”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”},{“old”:{“MST_VAS_TYPE”:{“MST_VAS_TYPE_ID”:”VAS_1001″,”VAS_TYPE_NAME”:”EW”,”VAS_TYPE_DESC”:”Extended Warranty”,”CREATED_ON”:null,”CREATED_BY”:null,”MODIFIED_ON”:null,”MODIFIED_BY”:null,”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”}},”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”},{“old”:{“MST_VAS_TYPE”:{“MST_VAS_TYPE_ID”:”VAS_1002″,”VAS_TYPE_NAME”:”COUPON”,”VAS_TYPE_DESC”:”Recall”,”CREATED_ON”:null,”CREATED_BY”:null,”MODIFIED_ON”:null,”MODIFIED_BY”:null,”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”}},”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”}],”@xmlns:SOAP”:”http://schemas.xmlsoap.org/soap/envelope/”,”@xmlns”:”http://services.vw.com/lpms/1.0/wsapp”}; a= o.tuple.map(function(val){ var inner = val[‘old’][‘MST_VAS_TYPE’]; var ret = {}; ret[inner[“MST_VAS_TYPE_ID”]] = inner[‘VAS_TYPE_NAME’]; return ret; }) sel = document.createElement(“select”); document.body.appendChild(sel); for (var index in a) { obj = a[index]; for (var prop in obj){ option = document.createElement(“option”); option.text = obj[prop]; option.value = prop; … Read more

[Solved] Showing Correct and Incorrect in a quiz [closed]

Try this 😉 var score = 0; var questions = [ [‘Question One?’, ‘1 Answer’], [‘Question Two?’, ‘2 Answer’], [‘Question Three?’, ‘3 Answer’], [‘Question Four?’, ‘4 Answer’], [‘Question Five?’, ‘5 Answer’], [‘Question Six?’, ‘6 Answer’] ]; var cA = []; var incorrect = []; function askQuestion(question, index) { var answer = prompt(question[0], ”); if (answer … Read more

[Solved] How to sum of table amount in javascript? [closed]

Like this: var tr = “”; var totalAmount = “”; var total = 0; //this your total var footerTr = “”; for(var i=1; i<=31; i++){ tr += `<tr> <td>${i}</td> <td>${i*2}</td> </tr>`; totalAmount += `${i*2}+`; total += i*2; //this your total } totalAmount = totalAmount.substring(0, totalAmount.length – 1); // remove last plus totalAmount += ‘=’+total; footerTr … Read more

[Solved] css plus to close button

There is no need to use javascript or keyframes to do that. I feel like your codepen is complicated for not much! Here is your code, modified, with my comments: body { font-family: sans-serif; } .btn-square { width: 100px; height: 100px; background-color: blue; transition: background-color 1s; /* Added */ } .close { position: relative; display: … Read more

[Solved] How can I show only table rows that contains a radio button value? [closed]

You can use jQuery filter function to detect the value. $(document).ready(function(){ $(‘input[name=”filter”]’).change(function(){ var value = $(this).val().toLowerCase(); if (value === “all”){ $(“#myTable tr”).show(); } else { $(“#myTable tr”).filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) }); } }); }); .table{ width: 100%; border: 1px solid #ddd; } .table tr, .table th, .table td{ border: 1px solid #ddd; } <script … Read more

[Solved] DOM manipulation with JavaScript or jQuery by moving element inside of its sibling [closed]

Got it! I forgot to put .length after $titleArray and I used appendTo() instead of prependTo(). Although the code doesn’t look so elegant now. But it’s a good start. var $titleArray = $(‘.title’); for (var i = 0 ; i < $titleArray.length; i++){ var $imageWrapper = $($titleArray[i]).parent().prev(); $($titleArray[i]).prependTo($imageWrapper); }; solved DOM manipulation with JavaScript or … Read more

[Solved] Add Close-Icon to embeded Youtube-Video [closed]

You can simply do this with jquery , see an example below : $(function(){ $(“.closeBtn”).click(function(){ $($(this).data(“target”)).fadeOut(500); }); }); .closeBtn { position: absolute; cursor: pointer; top: 5px; left: 5px; z-index: 999999; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script> <div id=”v1″> <div class=”closeBtn” data-target=”#v1″><img src=”http://downloadicons.net/sites/default/files/delete–delete-icon-32231.png” width=”30″ height=”30″ /></div> <iframe width=”932″ height=”510″ src=”https://www.youtube.com/embed/v5dU-dG9epY” frameborder=”0″ allowfullscreen></iframe> </div> solved Add Close-Icon to embeded Youtube-Video … Read more

[Solved] How do I delay an execution in Javascript?

You could use setTimeout(function(){dosomething}, timeout), btw. add console.log(‘something’) to see if the functions are actually executed. btw. if you’re using interval remember you might need to cancel it if you dont want it running forver, you could as well use recurring function (a function calling itself) with some condition on when to do processing or … Read more

[Solved] Jquery Form Validation

You can shorten this as much: $(document).ready(function() { $(‘#fromDate, #toDate’).click(function() { $(this).addClass(‘visited’); }); }); function apply() { var FirstName = $(‘#name’).val(); $(‘#name’).toggleClass(“error”, FirstName == “”); $(“#fromDate”).toggleClass(“error”, !$(‘#fromDate’).hasClass(‘visited’)); $(“#toDate”).toggleClass(“error”, !$(‘#toDate’).hasClass(‘visited’)); } Or you can pass this in the function args: <button class=”send” onclick=”apply(this)”>Send</button> now in the function: function apply($this) { var $els = $this.siblings(‘input’); $els.each(function(){ $(this).toggleClass(“error”, … Read more

[Solved] jquery ajax have error [closed]

The error would probably be from this being a plain Object rather than the Element. Every function has its own this value, determined when it’s invoked. And, inside of the success callback, this will typically refer to the settings of the request. $.ajax({ // … success: function () { console.log(this.type, this.url); // “POST” “/funfact_ajax” } … Read more

[Solved] How to create form slider with 5 values [closed]

You can use jquery selecttoUIslider component. This component takes the select form elements and generates a jquery UI Slider element. Here is an example from page. Markup <select name=”optiontype” id=”idselect”> <option value=”Economy”>Economy</option> <option value=”Value”>Value</option> <option value=”Average” selected=”selected”>Average</option> <option value=”Splurge a little”>Splurge a little</option> <option value=”Luxury”>Luxury</option> </select> Javascript $(‘#idselect’).selectToUISlider(); You can check the demo page here … Read more

[Solved] Replay jQuery function every 5 seconds

Ok, I am going to go out on a limb and make several assumptions here; one is that you wish to cycle between two elements repeatedly, another is that you are using $(this) in the context of the window rather than a containing element. If either of these are incorrect then the following solution may … Read more