JQuery's .val() not working in Facebox?

You need to wrap your code in an anonymous function, like.

You need to wrap your code in an anonymous function, like $(function() { ... }); or $(document). Ready(function() { ... }); may be this help's $(function() { $('. Add-tag-form').

Submit(function(){ alert($('input. Tags-input').val()); return false; }); }); please let me know if the problem still exists.

Go to facebox. Js line 254 change $.facebox. Reveal($(target).clone().show(), klass) to $.facebox.

Reveal($(target).show(), klass) Facebox is cloning the div you supplied instead of actually showing it. When you call .val(), it will return the value of the original div but the modified div (which the user interacts with) is actually a cloned div. I'm having the same issue.

After I fixed that, something else broke (facebox will load the div only once, when it is closed nothing seems to work).

The problem is that by the time your javascript code runs, the document hasn't been loaded yet. By the time you run $('. Add-tag-form'), jquery looks and does not find any element that matches the query, and so nothing happens.To fix this, do as Avinash says, and tell jQuery to run your code when the document is ready.

I usually do this with: $(document). Ready(function(){ ... }); Another thing, to be safe I also like to wrap my functions and call them with jquery, like so: (function ($){ $(document). Ready(function() { ... }); })(jQuery); This way if someone overrides the $ name, the script still works and I can still use the $ shortcut.

Actually the selectors work fine.. $('. Add-tag-form'). Submit(function(){ alert("hello world"); return false; }); $('.

Add-tag-form'). Submit(function(){ $("input. Tags-input").hide(); return false; }); These work fine.. It is the .val() that doesn't work.

– Shrihari Sep 24 '10 at 12:48.

As Ngo Minh Nam pointed out, facebox will make a clone of the original div, so you're reading the initial value of the input field. Here's my (ugly) workaround to make things work: $('#input_field_id'). Live('keyup', function() { $('#input_field_id').

Val($(this).val()); }); This will update the input field everytime a key is depressed inside the value box. UPDATE : forget that! Simply append #facebox before the id of the element you want to read.In my example: $('#facebox #input_field_id').val(); Please also note that you have to wrap these lines inside the $(document).

Bind('reveal. Facebox', function() {.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions