Tag: jquery

How to use Jsonp method in JQuery

JSONP is JQuery(JavaScript) method used to request data from a server in a different domain, something prohibited by typical web browsers because of the same-origin policy. JSONP takes advantage of the fact that browsers do not enforce the same-origin policy on<script> tags. JSONP is a viable solution for cross-domain Ajax. JSONP does not work with …

Continue reading

Permanent link to this article: https://blog.openshell.in/2014/06/how-to-use-jsonp-method-in-jquery/

Use Number() instead of parseInt() in javascript

Recently I came across the issue in converting string to integer in Javascript(JS). I was used parseInt() method to convert string value into integer value. unfortunately, I was faced issue in chrome browser but all other browsers like firefox, ie and safari are worked fine. Its too hard time for me to find out the …

Continue reading

Permanent link to this article: https://blog.openshell.in/2014/01/use-number-instead-of-parseint-in-javascript/

How to remove special characters using jQuery ?

jQuery code can be used to remove special characters. [js] <script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#input_field_name").keyup(function(event) { original_val = jQuery("#input_field_name").val(); rep_value = name.replace(/[^a-zA-Z 0-9.]+/g,”); jQuery("#input_field_name").val(rep_value); }); }); </script> [/js]

Permanent link to this article: https://blog.openshell.in/2013/12/how-to-remove-special-characters-using-jquery/

Submitting a form using jQuery AJAX

HTML form, that’s to be submitted by jQuery AJAX. [html] <form id=”employee” action=”employee.php” method=”POST” name=”contact”> <div>Name: <input id=”name” type=”text” name=”name” size=”30″ value=”" /></div> <div>Email: <input id=”email” type=”text” name=”email” size=”30″ value=”" /></div> <div>Phone: <input id=”phone” type=”text” name=”phone” size=”30″ value=”" /></div> <div><input id=”submit_btn” type=”submit” name=”submit” value=”Send” /></div> </form> <div id=”result”></div> [/html] Java Script code using jQuery AJAX …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/12/submit-form-using-jquery-ajax/

Dynamically create form in javascript on fly

To create a form dynamically using JavaScript on fly of the webpage. This which helps to create form and input controls dynamically. [javascript] /* To create form with javascript */ var form = document.createElement("form"); form.setAttribute(‘method’,"post"); // form method form.setAttribute(‘action’,"test.php"); // form action url form.setAttribute(‘name’,"frmName"); // form name form.setAttribute(‘id’,"frmId"); // form ID form.setAttribute(‘target’,"_blank"); // form target …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/12/dynamically-create-form-in-javascript-on-fly/

How to avoid Conflict in jQuery

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery’s case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/how-to-avoid-conflict-in-jquery/

Tips for using jQuery

Find if something is hidden: We use .hide(), .show() methods in jquery to change the visibility of an element. Use following code to check the whether an element is visible or not. if($(element).is(“:visible”) == “true”) { //The element is Visible } Center an element on the Screen: To make align the element to center. jQuery.fn.center …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/tips-for-using-jquery/

SlideShow using jQuery

Creating Image Slide Show using jQuery: In the code below you will see a surrounding div (id slideshow-area) which holds our slideshow content scroll area and our next and previous buttons. Inside our scroll area we have a div to hold the content and finally the content itself. As far as html goes this is …

Continue reading

Permanent link to this article: https://blog.openshell.in/2010/12/slideshow-using-jquery/