I have this select box in HTML, and the page it's on is being loaded into another page (both on my website) through an iframe. I want to be able to get the selected value from the select box (inside the iframe), and display it on the outside. Here's some code I've pieced together, but I don't know if i'm doing it right:
<script>
$('#iframe').contents().find('#cds').change(function() {
var selectVal = $(this).val();
url = 'https://twitter.com/intent/tweet?button_hashtag=stream&text=Just enjoying ' + selectVal + ' on';
$("twitter").attr("id", url);
});
</script>
Any advice?
To Clarify
- My
<select>
element is in theiframe
- I want to display the selected value outside the
iframe
- The source of the
iframe
is on the same domain as the page into which it is loaded