If we need to change the CSS class of a div or any other element with onclick or onmouseover etc. dynamically using JavaScript, you can do so using className. Follow the below example – Click here to see the class change Mouse over to see the class change
Tag: JavaScript
Open Thickbox With Onclick
There might be certain times when you would want to open a thickbox with onclick instead of the regular a href. Say you want to make a whole td cell clickable. To do so follow the below steps. 1. Open thickbox.js 2. Find the line – tb_init(‘a.thickbox, area.thickbox, input.thickbox’);//pass where to apply thickbox 3. Add… Continue reading Open Thickbox With Onclick
How To Change Value Of OnClick Event Dynamically With JavaScript
The following script changes the onclick event of the button “Test” dynamically according to which radio button is selected. The JavaScript function changeOnClick() changes the event dynamically. Hi! Hello! Bye!
jQuery Useful Links Of Tutorials, Manual, Examples
jQuery with its huge number of plugins is a Javascript framework that can do everything … well, almost everything 😛 So I list below few links that will help people working with jQuery 1. http://jquery14.com/ (14 consecutive days of new releases for jQuery 1.4)2. http://api.jquery.com/visual/ (A jQuery Manual that is helpful and stylish)3. http://jqueryui.com/demos/ (jQuery… Continue reading jQuery Useful Links Of Tutorials, Manual, Examples
Javascript Email Validation With Regular Expression
First lets see the code Now the explanation /^([a-zA-Z0-9_\.\-])+\@+([a-zA-Z0-9\-]{2,})+\.+([a-zA-Z0-9\.]{2,6})$/ ^[a-zA-Z0-9_\.\-] = Matching the beginning of the stringAny character from a-z, A-Z, 0-9 and . – _ \@ = @ [a-zA-Z0-9\-]{2,} = Any character from a-z, A-Z, 0-9 and –Number of characters should be at least 2There are no upper limit on number of characters \.… Continue reading Javascript Email Validation With Regular Expression
Get Selected Index And Option Text With JavaScript
The below example shows how to get the value, selected index, selected text of a drop down with JavaScript. The HTML select is below Select a value First Option Second Option Third Option Fourth Option Now the JavaScript to get the values. Within the firejs function (that is fired with onchange event) the following can… Continue reading Get Selected Index And Option Text With JavaScript
Include Code in Blogger Posts With Syntax Highlighting
If you have tried to post a few lines of code on your Blogger post, you must have faced the problem. The best solution I have found till date is a JavaScript code syntax highlighter. Its written by Alex Gorbatchev and can be found here – http://alexgorbatchev.com/wiki/SyntaxHighlighter And if you cannot upload the js files… Continue reading Include Code in Blogger Posts With Syntax Highlighting
JQuery Validation for Array of Input Elements
Sometimes we need to validate an array of input elements: For example – Select One aa bb cc dd Select One ee ff gg hh Select One ii jj kk ll Now we will use jquery validation plugin jquery.validate.js for validating the form. The condition will be that user will have to choose category from… Continue reading JQuery Validation for Array of Input Elements
Javascript Visual Effects With Scriptaculous (script.aculo.us)
If you are using Prototype as your javascript framework (even if you are not using it) and want some out of the box user interface effects you can try Scriptaculous (script.aculo.us). It is an add-on for Prototype and is really light and handy. Try out the following links site : http://script.aculo.us/ quick start guide and… Continue reading Javascript Visual Effects With Scriptaculous (script.aculo.us)
Get option text using Javascript
The HTML select is below Select Language PHP JSP C# And now the JavaScript