Friday, February 28, 2014

jQuery / Hide and show element using toggle() method

How to hide some element on page using jQuery?
We can use jQuery toggle() method.
It will add css style: "display:block" or "display:none"

jQuery
 

 

 

 
 
     
    Hide / Show
 
    
Some div content

jQuery / Hide or show elements on page

How to hide and show some element on page using jQuery?
We can do that using jQuery method: hide() or show().
It will add css style - "display: none;" or "display: block;"

jQuery
 

 

 

 
 
     
    Hide element 
Show element
Some div content

There is also other way to hide and show elements on www page.
You can use jQuery method: toggle(). See HERE

Wednesday, February 26, 2014

jQuery / get or set - text input value

How to check value of text input?
var myInputValue = $('#myInput').val();


jQuery
 

 

 

 
 
     
    Get input value
 
    


How to set input text value?
$('#myInput').val('My new value');


jQuery
 

 

 

 
 
     
    Set msg to second input

    Type here new msg