2

How to use Jquery if any field is being changed using javascript?

I have hidden field whose value is being changed as per change of other field using javascript.

Now I want jquery event function which can track this change of hidden field and do the needful.

I tried with this :

jQuery("#bannersize").change(function()

but it didnt worked for me as i wanted.

How can i do it?

1
  • 2
    You have to explicitly trigger the "change" event from your code that changes the field value. No events are automatically generated (by all browsers) when a field value is changed. Commented Sep 29, 2010 at 13:40

1 Answer 1

2

The following should trigger a "change" event. Call this code after you change your hidden field value:

$('#bannersize').trigger('change');
Sign up to request clarification or add additional context in comments.

2 Comments

+1 Do u mean to place in below html code or above the jQuery("#bannersize").change(function()
I mean place it wherever you are changing your hidden field value (I'm assuming you have some javascript which changes your hidden field value?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.