Reputation:
Hi i'm having a problem with posting from the input "searchtag" into "hash:'searchTag'" inside the javascript array. Please help me out! I'm very new to Javascript.
<form action="" method="post">
<input type="text" name="searchTag" placeholder="Search">
<input class="submit" name="Search" type="submit">
<div class="instagram"></div>
<script type="text/javascript">
$(".instagram").instagram({
hash:'searchTag',
clientId: 'My-clientId',
image_size:'tumbnail'
});
</script>
Upvotes: 1
Views: 66
Reputation: 531
You need to collect the value from searchTag
, which I assume you'll want to do when clicking the search button. For example:
$(document).ready(function() {
$('#SearchButton').click(function () {
var searchTag = $('#SearchTagInput').val();
$(".instagram").instagram({
hash: searchTag,
clientId: 'My-clientId',
image_size:'tumbnail'
});
});
});
The above example requires that you add the corresponding ids, SearchButton
and SearchTagInput
, to the input fields.
See this fiddle for an example.
Upvotes: 2