Category: JavaScript

  • Define constant in angular 2

    Say you are fetching JSON data from an api url which is http://localhost:8080/api, and you have to use it for a a number of times

  • Changing HTML with JavaScript

    Changing html with javascript is very simple but tricky, one can use InnerHTML javascript property to do that. Below I will show you how to do this step by step. <html> <body> <div id=”target”>will change this html</div> <script> document.getElementById(“target”).innerHTML=”here is the new html”; </script> </body> </html> Our goal is to change the html content of […]

  • Zen Coding — a tremendous way of writing HTML and CSS code

    Zen Coding is a set of plug-ins for text editors that allow for high-speed coding and editing in HTML, XML, XSL, and other structured code formats. The tools have been incorporated into a number of high-profile text editors, some plug-ins developed by the Zen Coding team and others implemented independently. However, Zen Coding is primarily […]

  • Set default image or text in html input box

    Suppose you have a user login panel which shows two input text field, one for username & another for password. Now you don’t wanna use level for this input box. Then What!!!!!!! Simply show text or image inside input box. Here is the code….. [sourcecode language=”javascript”] <form action="#" method="post"> <input name="login_username" value="email" type="text" onfocus="if(this.value==’email’) this.value=”;" […]

  • Form submit by ajax/jquery

    [sourcecode language=”javascript”] $(function(){ $.ajax({ type: "post", url:example.php, data: $("#user-form").serializeArray(), success: function(response){ alert(response); $("#response-div").html(response); } }); }); [/sourcecode]

  • Top jquery lightbox scripts recent most beautiful

    Recent most updated top jquery lightbox plugins for web developers

  • Onclick remove deafult data or value from input box

    Sometimes you want to put a default value in your input box. Like in a input box you put default value is email and another input box you put default value as user name. Your goal is, whenever the user click on the first input box, by default which is shown “email” text, it will go away automatically and user can write his own email address there. Main purpose is, user have to delete the “email” text manually and then have to write his email address. By implementing a trick could save the time of that manual text deletion.