[Solved] Use a span tag to change div background-color onclick [closed]

Using vanilla JavaScript (no libraries): //We attach a click handler on the nearest common parent. //This allows us to have only one event handler, which is better //For performance! document.getElementById(“parent”).onclick = function(e) { //We only want events on the spans, so let’s check that! if (e.target.tagName.toLowerCase() == “span”) { this.style.backgroundColor = “#BADA55”; //This is for … Read more

[Solved] css box with two different shapes

This is an answer based off of the one by damien hawks. I have included some jQuery so that both shapes change color on hover. You can adapt this to be closer to the code you had provided. DEMO HTML: <div id=”rectangle” class=”hover”></div> <div id=”halfCircleBottom” class=”hover”></div> CSS: .hover { background-color: #e7f4ef; } .hovered { background-color: … Read more

[Solved] remove html input tag from string using C#

You could remove input tags from the string with a regular expression: var temp = “The accounting equation asset = capital + liabilities, which of the following is true. Ram has started business with 5,50,000 and has purchased goods worth 1,50,000 on credit <input type=”radio” id=’op1′ name=”q2option” value=”1″ /> a) 7,00,000 = 5,50,000 + 1,50,000 … Read more

[Solved] Two if statements?

Yes you can, but you can also use AND operator : if(true && true){} else{} //Will go in the if if(true && false){} else{} //Will go in the else If you want multiple if : if(true){ if(true){} }else{ if(true){ }else if(true){ } } Note that if you do a nested if : if(true){ if(false){} }else{ … Read more

[Solved] Save textbox as variable without submitting [closed]

PHP is the sever-side programming language while JavaScript (jQuery) runs on the client-side. we can use PHP to write JS, but JS can’t affect PHP (except via AJAX or similar). What you can do is use SESSION here is sample code. Js Code $(“#varenummer”).change(function(e) { e.preventDefault(); var data_posts = $(this).val(); // Send Ajax request to … Read more

[Solved] How to set font size in textbox using Dropdown list javascript [closed]

You can use jQuery To Simple down the code LAB DEMO HTML CODE: <input type=”text” value=”Sample Text” id=”txtBox” name=”name”> <br> <select id=”fontSizeDD”> <option value=”12″>12</option> <option value=”14″>14</option> <option value=”16″>16</option> <option value=”18″>18</option> <option value=”20″>20</option> <option value=”22″>22</option> <option value=”24″>24</option> <option value=”26″>26</option> </select> jQuery CODE : $(function(){ $(“#fontSizeDD”).change(function(){ $(“#txtBox”).css(“font-size”,$(this).val() + “px”); }) }); Pure JavaScript Solution var fontSizeDD = … Read more

[Solved] Changing img src in jQuery

check to HTML <ul class=”social-media-nav-center”> <li> <a href=”https://twitter.com/” target=”_blank”><img id=”twitter” class=”small” src=”https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRgdlWvqZIB0r6qkjFS_t9uMKD9gQIVMV3fE-Vw9BMoRfNEmJG2″ /> </a> </li> </ul> Jquqey $(document).ready(function(){ $(window).scroll(function(){ if($(window).scrollTop() > $(window).height()) { $(“#twitter”).attr(“src”, “http://www.planwallpaper.com/static/images/744081-background-wallpaper.jpg”); } }) }) CSS .social-media-nav-center{height:1000px;} https://jsfiddle.net/yakcbanL/ 2 solved Changing img src in jQuery

[Solved] Text change when background colour changes using Javascript

Simply have the text in an array, ( get it from some elements using jquery – however you want it) iterate through it and change the content inside the div using html() function when you are changing the color. Simple modification of your code would be something like function changeColorAndText(element, curNumber){ curNumber++; if(curNumber > 4){ … Read more