Skip to content
Advertisement

Tag: jquery

Javascript – convert youtube/vimeo url’s into embed versions for use on a forum comment feature

Trying to make something similar to facebook. I’ve created this javascript url pattern converter. Something like this could be triggered just as the user clicks on the submit button for a forum post – convert url’s into embed html variants. Any ways to improve this? http://jsfiddle.net/88Ms2/377/ Answer LATEST CODE ******** http://jsfiddle.net/88Ms2/378/ This mimics the facebook post feature – of turning

Validation for 10 digit mobile number and focus input field on invalid

I need the code for validating email and mobile number in jQuery and also focus() on that particular field where validations are not satisfied. This is my query Answer for email validation, <input type=”email”> is enough.. for mobile no use pattern attribute for input as follows: you can check for more patterns on http://html5pattern.com. for focusing on field, you can

FormData is empty when using jQuery ajax()

I try to submit form with file with jQuery.ajax. Google says I should use FormData which will automagically encode the file and all inputs into the one object which I can send via XHR. Well, the FormData object is empty. It’s empty in the debugger and on the server side. I can’t find the error. Here is the code. The

Can’t stop setInterval with clearInterval

Been playing with this in a fiddle for 4 hours now and cant find a solution… HTML: js: Note: because clearInterval is not working you need to click on “run” in the jsfiddle to get it to stop after clicking the checkbox, you have 7 seconds between alerts… Here is a link to the jsfiddle: http://jsfiddle.net/5udtC/5966/ Thanks! Answer Don’t redefine

How to combine two javascript FormData objects

I need to combine two FormData objects and post them using XMLHttpRequest. One of the forms contains file input. It doesn’t work when I use $.extend or if I use serialize() to combine the form that doesn’t have file input. Any idea how to do this? Answer You cannot couldn’t. FormData is was unfortunately not enumerable. However, as you say

ReferenceError: $ is not defined

I have this error message ReferenceError: $ is not defined This is my header. Following is my JavaScript code Following is the HTML I want to show datepicker on the input tag. I am using Bootstrap V3.1. I am using this datepicker. Answer Add jQuery library before your script which uses $ or jQuery so that $ can be identified

My displayError() function is not working at all

I made a function that should display an error or remove an error. Unfortunately, when I use the function in any way, for example like displayError(true, “test”);, it’s not working. When I check my html code to see if anything changes, nothing is changed. Anybody who can identify the problems? Answer I found out about the console log method. So

Advertisement