[Solved] on click, reduce countdown with 1 and so something, when countdown reaches 0 open window

This code is maybe the solution you wanted: function countdown() { var i = document.getElementById(‘counter’); if (parseInt(i.innerHTML)<=0) { $(“#counter”).fadeout(); i.innerHTML =10; i.style.width=”100%”; $(“#counter”).fadein(10); } else { i.innerHTML = parseInt(i.innerHTML)-1; setTimeout(function(){ var i = document.getElementById(‘counter’); i.style.width=”10%”; i.innerHTML=”1″; },5000) } var msg = window.open(“”, “Window name”, “width=200, height=100”); msg.document.write(“Some HTML”); } You have to add jquery in … Read more

[Solved] How to select all cell starting, containing or ending with some word with JQuery/CSS?

you can use regular expressions. These two regexp checks if text contain “John” (anywhere) and ends with “1”: $(‘#myTable’).find(‘td’).each(function() { var str = $(this).text(); if (str.match(“John”) && str.match(“1$”) ) { $(this).css(‘background’, ‘red’); // …or do something else with it. } }); 3 solved How to select all cell starting, containing or ending with some word … Read more

[Solved] Java Script not working [closed]

Please don’t ask us to debug your websites / scripts without checking basic things by yourself. This is console output from Chrome (F12 or CTRL+SHIFT+i) Failed to load resource: the server responded with a status of 404 (Not Found) http://dev.eurodiet.ro/Scripts/jquery-1.4.2.min.js Failed to load resource: the server responded with a status of 404 (Not Found) http://dev.eurodiet.ro/Scripts/swfobject_modified.js … Read more

[Solved] sorting by first digit

.sort() should reorder the items like that by default. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values. console.log( [1, 2, 3, 4, 10, 11, 12, 20, 29, 30, 39, 40, 49, 101, 110, 119, 123].sort() ); 1 solved sorting by first … Read more

[Solved] Is it possible to update a textarea-element with data from an AJAX call? [closed]

You want a textarea to display the contents of logs.php, and update every 2 seconds. I think this should do it: <script> $(document).ready(function(e) { $.ajaxSetup({cache:false}); setInterval(function() { $.get(‘logs.php’, function(data) { $(‘#chatlogs’).text(data); }); }, 2000); }); </script> <textarea name=”” id=”chatlogs” style=”width:100px; height:100px”></textarea> Note you also need to add id=”chatlogs” to your textarea for this to work. … Read more

[Solved] Show calculation of textboxes with decimal using javascript [closed]

Try this: $(‘#Text4’).val(parseInt($(‘#Text1’).val()) * 100 + parseInt($(‘#Text2’).val()) + parseInt($(‘#Text3’).val()) / 10); function doCalculation() { $(‘#Text4’).val(parseInt($(‘#Text1’).val()) * 100 + parseInt($(‘#Text2’).val()) + parseInt($(‘#Text3’).val()) / 10); } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <input name=”txtArea1″ type=”text” id=”Text1″ style=”width: 20%;” /> – <input name=”txtArea2″ type=”text” id=”Text2″ style=”width: 20%;” /> – <input name=”txtArea3″ type=”text” id=”Text3″ style=”width: 20%;” /> <input name=”txtGuntha” type=”text” id=”Text4″ style=”width: 80%;” … Read more

[Solved] RegEx help in JavaScript – extract second match [duplicate]

const regex = /”\w+\|/g; const str = `mmSuggestDeliver(0, new Array(“Name”, “Category”, “Keywords”, “Bias”, “Extension”, “IDs”), new Array(new Array(“Advance Auto Parts Inc.”, “Aktien”, “982516|US00751Y1064|AAP||”, “85”, “”, “Advance_Auto_Parts|982516|1|13715”),new Array(“iShares China Large Cap UCITS ETF”, “Anzeige”, “”, “100”, “”, “http://suggest-suche-A0DK6Z”)), 2, 0);`; let m; while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite … Read more

[Solved] Why does Math.round(1.53*20)/20 = 1.55? How does this actually work?

Math.round() will return the nearest integer value as described here For your input Math.round(1.53*20)/20 it will first calculate 1.53*20 answer is 30.6 Then your expression becomes Math.round(30.6)/20 After that result of Math.round(30.6) is 31 (nearest integer) Then your statement becomes 31/20 which is 1.55 solved Why does Math.round(1.53*20)/20 = 1.55? How does this actually work?

[Solved] How to popup an alert when every cell in a table has been clicked?

If you’re wanting to set each cell to have a red background individually on click it would be done like this and will alert after all 5 have been clicked. $(‘#one, #two, #three, #four, #five’).click( function() { $(this).toggleClass(“redbg”); if($(‘.redbg’).length == 5) alert(‘Bingo!’); }); .redbg { background: red; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <table> <tr> <td id=”one”>1</td> <td … Read more