$(document).ready(function () {
var Href = 'http://www.apple.com';
$("#fancybox-manual-b").click(function () {
$.fancybox.open({
href: Href,
type: 'iframe',
padding: 5
});
});
});
<ul>
<li><a id="fancybox-manual-b" href="javascript:;">Open Window</a></li>
</ul>
I need to get the ‘Href’ value from a textbox and when ever someone puts a website in the textbox it should get that instead of apple.com
If you have some html like:
Then you can use jQuery’s val function to get the value of the textbox by its
id:Which you’ll obviously need to do every time someone clicks your fancybox link, so that you get the most up to date value from the textbox:
It’s worth noting that if a user puts some text in the input that doesn’t resolve to an existing url you’re going to get an error.