In this section I will show you that how we can use the simple regular expression to know whether the specified string contains the special characters or not. Continue reading “How to know whether string contains special characters or not in JavaScript”
Tag: jquery Demo
Code snippet: Create a new row in the HTML table using jQuery
You can create a new row in the existing html table at run time using the jQuery. The following code sample shows how to create a new row in to the html table. Continue reading “Code snippet: Create a new row in the HTML table using jQuery”
Code snippet: Create JSON string from the web grid in MVC 4
The following JavaScript function returns the JSON string from the data of all displayed rows in the Web Grid control in the MVC framework.
You need to replace web grid id from the #employeeGrid in the third line of the function. Continue reading “Code snippet: Create JSON string from the web grid in MVC 4”
Change the caption of the button on click in JavaScript and jQuery
The following code samples demonstrate how can you change the text of the existing controls at client side. The example change the text of a button ‘show image’ to ‘hide image’ after showing the image on the click event. You can see in the below demo: Continue reading “Change the caption of the button on click in JavaScript and jQuery”
How to redirect page using JavaScript
Today i have a requirement to redirect page to another on the basis of the some condition using the scripting and i use the windows.location.href. There are others method to redirect the page: you can use the windows.location.href= and windows.location.replace() . Continue reading “How to redirect page using JavaScript”
HTML select element and jQuery
The HTML select element represents a control that presents the collection of the options. The options within the collection are represented by option elements. The select element behaves just like a menu that contains the various sub menu-items. In this post we will see the various task on the select and option elements using jQuery. Continue reading “HTML select element and jQuery”
HTML input tag that accepts only numeric values using JavaScript
I need to restrict certain number of input field to takes only numbers values. Basically my form is not a submit form so that i can not put the simple validation on the form submission. I want the user to be unable to enter the any other characters than numeric values. Continue reading “HTML input tag that accepts only numeric values using JavaScript”
Refresh the current web page using jQuery
We can use the document.location.reload() function to refresh or reload the current web page in jQuery. Continue reading “Refresh the current web page using jQuery”
Set the src attribute of the iframe element using jQuery
The following code snippet shows that how you can set the src attribute of the iframe element using jQuery. In the example set the src attribute of the iframe on the click of the submit button.
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function(){ $("#btnSubmit").click(function(){ $('#iframWelcome').attr('src', 'welcome.html'); }); }); </script> </head> <body> <form> Enter the name: <input type="text" id="txtName" > <input type="button" id="btnSubmit" value="Submit" /> <iframe id="iframWelcome"> </iframe> </form> </body> </html>
To set the alt attribute, simply pass the name of the attribute ‘src‘ and its value to the .attr() method of the iframe element selector in jquery.
Get the element of the parent window from the iframe in jQuery
The following code snippets will show that how you can access an element of the parent window from the iframe document. The first html document has a input text type control, one button type input control and iframe element. We need to assign value of input text control in the span which are in iframe document using jQuery. Continue reading “Get the element of the parent window from the iframe in jQuery”