1

How to stop execution of function in javascript?

Please see below code:

 if(m=='') { alert("novalue"); getDate().stopPropagation(); } 

I want that if(m==null) the getDate() should not get executed.

How this can get achieved in javascript?

2
  • 3
    ...use a nested if? Commented Sep 1, 2013 at 14:38
  • 2
    use === instead of ==? Commented Sep 1, 2013 at 14:38

2 Answers 2

1

You can modify the if condition as below

 if(m=='' && m !== null) { } 

This may help you.

Sign up to request clarification or add additional context in comments.

Comments

1

did you changed the question?

if (m==='') { ... } 

=== matches the value and the type

2 Comments

actually i go stuck here "getDate().stopPropagation();"
That's because stopPropagation() is not a method of the Date object. What are you trying to do?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.