Solved

how to call Jquery function inside the JS function

Posted on 2014-11-04
1
278 Views
Last Modified: 2014-11-11
Hi ,
	// Avoiding duplicate Head value 

	jQuery(function($) {
	alert("1234");
    var backups = {};
    $("select[id^=headNo]").change(function() {
        var v = $(this).val();
        alert(v);
        var f = false;
        $("select[id^=headNo]").not(this).each(function() {
        alert("456");
        alert($(this).val());
            if($(this).val() == v) {
                f = true;
                return;                
            }
        });
        if(f) {
            $(this).val(backups[$(this).attr("id")]);
            alert("Duplicated Head Value!");
        }
        else {
            backups[$(this).attr("id")] = v;
        }
    }).val(null);
});

Open in new window


I have code like this in JS file . I Want to call this code from JS function how to call ?
0
Comment
1 Comment
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
You have to turn it into a 'named function' so that it can be called by name.  http://learn.jquery.com/javascript-101/functions/
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jQuery aJax Disable Async 24 39
Responsive CSS question 2 37
jQuery animation faster 1 16
Hidden Field Value 10 33
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now