I am submitting a form with ajax and have a one input field inside div with css display:none for catching spambots but for some reason I can't get the value of the input inside an container with display:none ???
$("#submit_btn").click(function(e) { e.preventDefault(); //get input field values var dummy_field = $('input[name=dummy]').val(); var user_name = $('input[name=name]').val(); var user_email = $('input[name=email]').val(); var user_phone = $('input[name=phone]').val(); var user_message = $('textarea[name=message]').val();
Can anyone recommend a slideshow plugin that supports both images and embedded youtube videos. I need something that will look like the below mockup when you click on a thumbnail the image or video is loaded in the larger preview window. The images that would be used are variable sizes so ideally think it would need to use a container possibly utltising CSS background-size:cover to get a decent coverage of each thumbnail whilst keeping everything uniform in the thumbnails grid.
I want to add a reset link to tis script that shows a thubnail preview of image upload, can ayone help please?:
function previewImage(el,widths,limit){
var files = el.files;
var wrap = el.parentNode;
var output = wrap.getElementsByClassName('imagePreview')[0];
var allowedTypes = ['JPG','JPEG','GIF','PNG','SVG','WEBP'];
output.innerHTML='Loading...';
var file = files[0];
var imageType = /image.*/;
// detect device
var device = detectDevice();
if (!device.android){ // Since android doesn't handle file types right, do not do this check for phones
if (!file.type.match(imageType)) {
var description = document.createElement('p');
output.innerHTML='';
description.innerHTML='<span class="KT_field_error" style="font-size:12px;font-weight:bold;">File format not accpeted. Allowed file types are '+allowedTypes.join(', ')+'</span>';
output.appendChild(description);
return false;
}
}
var img='';
var reader = new FileReader();
reader.onload = (function(aImg) {
return function(e) {
output.innerHTML='';
var format = e.target.result.split(';');
format = format[0].split('/');
format = format[1].split('+');
format = format[0].toUpperCase();
// We will change this for an android
if (device.android){
format = file.name.split('.');
format = format[format.length-1].split('+');
format = format[0].toUpperCase();
}
var description = document.createElement('p');
description.innerHTML = '';
if (allowedTypes.indexOf(format)>=0 && e.total<(limit*1024*1024)){
for (var size in widths){
var image = document.createElement('img');
var src = e.target.result;
image.src = src;
image.width = widths[size];
image.title = 'Image preview '+widths[size]+'px';
output.appendChild(image);
}
}
if (e.total>(limit*1024*1024)){
description.innerHTML += '<span class="KT_field_error" style="font-size:12px;font-weight:bold;">Your image exceeds the file size limit of '+limit+'MB</span>';
I have a PHP web application and I want to create a jQuery mobile version - Are the any tools that would do a lot of the work/conversion for me or do I need to rebuild the forms/layout etc from the ground up. The CSS/layout is pretty old so the first instance we wanted to build the jQuery mobile version then detect mobile/tablet devices and redirect them to the jQuery mobile version.
2nd phase is to build the mobile apps for iOS and Android but I'm primarily concerned with creating the jQuery mobile version and deploying for the web in the first instance.
I want to show/hide areas based on the state of a checkbox and the value of a radio group, this works but looks long-winded & can someone tell me a more elegant way to do this please so its fired on page load and checkbox state change:
I have a vanilla js function below that prevents any line breaks in a textarea whats the jquery equivalent of this please, covering all bases if users is typing or pasting content.: