Getting Value Of An Element Inside Facebox Div Using Jquery
I have two div tags as shown below on my page. When i reference the value of itemName element,using $('#itemName').val(); which i have in both the divs, i always get the value of t
Solution 1:
If you look inside facebox.js, you'll see that there is an event that is triggered when facebox opens, so you just need to bind to that event, then obtain the value:
$(document).bind('reveal.facebox', function() {
$('#facebox #itemName').val();
})
Solution 2:
An element id must be unique within a document. Your document is invalid and this is one of the consequences.
Make use of a validator, it is a cheap form of QA that makes it easy to grab some low hanging fruit.
Solution 3:
IDs have to be unique on the page - the simple answer is you need to rename one of them.
If you really can't change them then you could use something like this:
$('#facebox input[type=text]:first').val();
Post a Comment for "Getting Value Of An Element Inside Facebox Div Using Jquery"