Category: Jquery & Javascript
Object Oriented Concept in javascrips?
Object oriented always used to refer about objects. Programming based on objects( actually a building block of javascript). All javascript components are objects. Eg: strings, functions etc… A s... Read Moredisplay none using javascript
Either we can use show() and hide() functions for this: $(“#hide_id”).hide(); $(“#hide_id”).show(); Or using css in scripts: $(“#hide_id”).css(“display”... Read MoreHow to check if element exists in the html page using javascript?
Suppose it is a div with id “slots” then in jquery: if( $(“#slots”).length < 1 ) { console.log(“Div is not present”); }else { console.log(“Div with id #slo... Read Morelast element in an array using java script
arrayname.slice(-1)[0]; arrayname.slice(-1).pop();... Read MoreUncaught TypeError: Cannot read property ‘className’ of null
This error occurs because we called a class or id that is not defined inside the body tag in html , or its div is not defined in a proper way. Actually div is not existed, there is no element html ele... Read MoreSubmit a form using javascript
We can submit a form using its name, id, class and tag <form id=”form” name=”form1″ class=”form”> </form> Suppose forms name is “form1”, the... Read MoreHow to make page scroll position to top at page refresh in HTML
$(document).ready(function(){ $(‘html’).animate({scrollTop:0}, 1); $(‘body’).animate({scrollTop:0}, 1); });... Read MoreAdd placeholder using javascript for a input field
If input field has an id “s” Then: $(“#s”).attr(“placeholder”, “Search”);... Read MoreAdding a new attribute using jquery to a div :
Specify the attribute to the selector as below: $(“.ad”).attr(“height”,”500px”); $(“#ad”).attr(“height”,”500px”); $(“pR... Read More- 2 of 4
- « Previous
- 1
- 2
- 3
- 4
- Next »