[Solved] I don’t understand the if{} statement

The if in your code is prefixing the value of i with a zero if it is less than 10 1 becomes 01 2 becomes 02 10 stays as 10 etc This is so that cosmetically, the hour & minute are displayed as expected. The formatting is a bit misleading – better written as function … Read more

[Solved] JavaScript onload function not executing [closed]

Here is the working code, made few fixes like we need to use getDate() instead of getDay(), (today.getMonth() + 1) and handled season5[0]. http://jsfiddle.net/sahilbatla/p7rfcLgt/ <script> function compareDate() { console.log(“Function fired”); var today = new Date(); var todayDate = today.getFullYear() + “,” + (today.getMonth() + 1) + “,” + today.getDate() + “,” + today.getHours() + “:” … Read more

[Solved] how do i send two messages in one? [closed]

You Could Use \n To Make a New Line or You Can Use this code to make the text a link const embed = new Discord.MessageEmbed() embed.setTitle(“BOT INVITE LINK”) embed.setColor(“BLACK”) embed.setURL(“INVITE LINK”) embed.setDescription(“**Click On The Blue Title Above to Invite BOT to Your Server :D**”) message.channel.send(embed) solved how do i send two messages in one? … Read more

[Solved] How to add a single letter filter to input box [closed]

Here is a snippet with two input boxes: the top one defining the replacement rules and the bottom one accepting any text input to be processed: function mkdict(){ dict={}; key.value.split(“,”).forEach(kv=>{ let [k,v]=kv.split(“=”); dict[k]=v; }); transform(); } function transform(){ out.textContent=text.value.split(“”).map(c=>dict[c]||c).join(“”); } var dict; mkdict(); key.addEventListener(“input”,mkdict); text.addEventListener(“input”,transform); <input type=”text” value=”i=!,t=7″ id=”key”><br> <input type=”text” id=”text”> <div id=”out”></div> For … Read more

[Solved] logic required in javascript

Your select tag should be <select name=”amt” id=”amt” onchange=”return totprice(this.value,2,110);” multiple> To make it multi select. Now when user will select multiple options (using Shift+click) then in your JavaScript function get these values and do the processing (provide discount/ any logic) Updated You wish to multiply the value the user has selected with the discount … Read more

[Solved] Equivalent of and in JavaScript?

A googling for “javascript AND operator” returns a first hit of http://www.w3schools.com/js/js_comparisons.asp which clearly explains the answer: if (i % 3 && 5 === 0) This is the answer you’re looking for, but given how it’s written, it might not give you the outcome you expect depending on execution. 5 solved Equivalent of and in … Read more

[Solved] I want to remove repetative elements of an array without using any in-built methods of javascript. When remove a then with a, A also to be removed

I want to remove repetative elements of an array without using any in-built methods of javascript. When remove a then with a, A also to be removed solved I want to remove repetative elements of an array without using any in-built methods of javascript. When remove a then with a, A also to be removed

[Solved] javascript get the current class number [closed]

Its Very Simple: Just Use .html() , .index() , .text() with the selector Like This Fiddle: http://jsfiddle.net/PzWxs/5/ Here is the Code : var currentClassValue = $(‘li.current’).html(); alert(currentClassValue); OR var currentClassValue = $(‘li.current’).index(); alert(currentClassValue); OR var currentClassValue = $(‘li.current’).text(); alert(currentClassValue); Use any one of the above you like 🙂 5 solved javascript get the current class … Read more

[Solved] Which is fastest? closest() vs manual traversing in jQuery [closed]

These do different things. .closest(‘.DivB’) will traverse the DOM tree up until it finds an element that matches the selector (probably none). .parent().next() will do what it looks like it will do, find the parent then its next sibling. What you want is .closest(‘td’).find(‘.DivB’) and don’t worry about micro-optimizations. It won’t break when the DOM … Read more

[Solved] What language should i use for dynamic client side and server side form validation? [closed]

Easiest option for me, is to learn PHP for server-side validation. If you want to add client-side validation (which is not a “MUST”, but is a “PLUS”), you can use Javascript. Avoid using Ajax, jQuery or any kind of advanced libraries and functionalities until you get a basic understanding of what happens where. 4 solved … Read more