Category: Javascript

Installing nodejs on CentOS 7 with NVM

Naveen Nayak November 8, 2018 No Comments Javascript, Web Development ,

Using NVM(Node Version Manager) we can have multiple nodejs versions and switch between them quickly. I am doing this on CentOS 7. # install nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash # open a new terminal and check the version nvm –version # install latest node LTS and check version nvm install –lts node –version npm […]

Ajax File Upload without iframe

Naveen Nayak February 10, 2015 No Comments Javascript, LAMP, Web Development

The Invisible I-frame File Upload method works in almost all browsers. This post explains using FormData to submit forms that is supported by most new browsers. <? if( isset($_POST) && ! empty($_POST) ) { $file = $_FILES[‘myfile’]; $output =”Response From the Server\n”; $output .= “myInput = “.$_POST[‘myInput’]; $output .= “\n”.’File Name: ‘.$file[‘name’]; $output .= “\n”.’File […]

jQuery select lists

Naveen Nayak November 7, 2011 No Comments Javascript

Get the value of the selected item  $(“listBoxSelector :selected”).val(); Get the text of the selected item  $(“listBoxSelector :selected”).text(); Get multiple selected values ( or loop through all selected values ) $(“listBoxSelector :selected”).each(function(i, selected){      var value = $(selected).val();      var text = $(selected).text(); }); Empty a list  $(“listBoxSelector”).empty(); Append Options to a list  […]

Jquery Tips

Naveen Nayak November 3, 2010 No Comments Javascript

Contains common Jquery code Display jQuery version alert(jQuery.fn.jquery); Find how many check boxes have been checked var count = $(‘input[type=checkbox]:checked’).length; Get ID, class of an element var element_id = $(this).attr(‘id’);   or element_id = this.id; var class = $(this).attr(‘class’);   or class = this.class; Set the attribute of an element $(this).attr(‘class’, ‘new-class’); $(this).attr(‘title’, ‘new-title’); Set […]

Page 1 of 1