Make Div enter a search value [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I would like to make this div tag "tile 1" to be selectable and upon clicking it retrieves search results based on a key word.
<div id="tile1" class="live-tile" data-swap="image" data-direction="horizontal" data-stops="80px,90%,100%,90%,0" data-delay="6000">
<div>
<img class="full" src="../bakeware2.png" alt="2" />
</div>
<div>
<img class="full" src="../bakeware3.png" alt="3" />
</div>
</div>
Here is the code that I use for my search bar.
<table align="center">
<tr>
<td align="center"><form action='search.asp' method='post'>
<div style="float:left;">
<input type="search" style="color:#000;" name="keyword" size="30" data-mini="true" value="bakeware">
</div>
<div style="float:left;">
<input type=image src="http://www.kitchenova.com/assets/templates/v32029/images/btn-search.gif" border="0" />
</form></td>
</tr>
</table>
Is there a way I can make the div "tile1" click-able and have it display the results as if I were to type in say "cookies" in the actual search bar itself?

Is this FIDDLE what you're looking for?
JS
$('.clickme').click(function(){
var typeaword = $('#getme').val();
typeaword = '123' + typeaword + 'xyz';
$('.putmehere').html(typeaword);
});

Related

Javascript Regex for specific tags (keep content) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm looking for a special regex. An API returns to me a string of character, I would like to remove the style included, table, tr and td but i want to keep the content.
Someone can explain how can i do this ? Thank you very much ?
<table class="footer">
<tr>
<td><img src=""/></td>
<td>
content<br />
content<br />
<div class="">
content
<br />
content
</div>
</td>
</tr>
</table>
Rather than a regular expression, why not use DOMParser instead?
const htmlStr = ` <table class="footer">
<tr>
<td><img src=""/></td>
<td>
content<br />
content<br />
<div class="">
content
<br />
content
</div>
</td>
</tr>
</table>`;
const doc = new DOMParser().parseFromString(htmlStr, 'text/html');
console.log(
doc.querySelector('td:nth-child(2)').textContent
);

how to pupoulate radio buttons and display this form [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am using materialize framework and i have to populate this form using java script. I am not sure how to access them in my js file
<div class="row col s10 offset-s1" id="questionArea" style="display:none">
<blockquote class="flow-text"> Select the capital of the country shown below.</blockquote>
<div class="input-field col s6">
Question <span id="quesTextSpan"></span><p>
<input name="qOptions" type="radio" id="optionId0" class="with-gap qOptionClass" />
<label for="optionId0"></label>
</p>
<p>
<input name="qOptions" type="radio" id="optionId1" class="with-gap qOptionClass" />
<label for="optionId1"></label>
</p>
<p>
<input name="qOptions" type="radio" id="optionId2" class="with-gap qOptionClass" />
<label for="optionId2">d</label>
</p>
<p>
<input name="qOptions" type="radio" id="optionId3" class="with-gap qOptionClass" />
<label for="optionId3"></label>
</p>
</div>
</div>
You can access the values of the radio buttons like this:
var radioVal = document.getElementById('optionId0').checked;
You can then perform logic on them by using conditionals and functions.
To gather them all quickly I would recommend doing this.
var radios = document.querySelectorAll('input[type="radio"]');
This will give you an array with each of the elements.
You may then go through and change the value to true or false depending on how you want to populate them.
Example)
radios[0].checked = true // Sets the first radio button to be on.
Edit)
To display the div use:
document.getElementById('questionArea').style.display = '';
To hide the div use:
document.getElementById('questionArea').style.display = 'hidden';

Seat Reservation (Change color when submit) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I want to ask some question...I'm want to make seat reservation which when user submit their selected seat..the table data will change color into red...Help..
<tr id="place">
<td width="50px" height="45px" bgcolor=lightgreen>
<input type="checkbox" name="seatNumber[]" value="A04" onclick="return KeepCount()" id="size"/><br> A04</td>
<td width="50px" height="45px" bgcolor=lightgreen>
<input type="checkbox" name="seatNumber[]" value="A05" onclick="return KeepCount()" id="size"/><br> A05</td>
<td width="50px" height="45px" ></td>
<tr id="place">
<td width="50px" height="45px" bgcolor=lightgreen>
<input type="checkbox" name="seatNumber[]" value="A08" OnClick="return KeepCount()" id="size"/><br> A08</td

JavaScript style.height not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I'm trying to set the height of div on my page, because my page content is dynamic. But it don't work.
CSS:
<style type="text/css">
#figmenu {
height: 50px;
}
</style>
JS:
<script type="text/javascript">
function HeightUp() {
var fm = document.getElementById('figmenu');
fm.setAttribute('style', 'height: 500px');
// fm.style.height = '500px';
}
</script>
HTML:
<body>
<div id='cssmenu' onclick=HeightUp();>
<input type="submit" name="change" value="First Button" id="figs"/>
<input type="submit" name="change" value="Second Button" id="tr"/>
<input type="submit" name="change" value="Third Button" id="fbp"/>
</div>
<div id='figmenu'>
<input type="submit" name="change" value="4th Button" id="b4"/>
<input type="submit" name="change" value="5th Button" id="b5"/>
<input type="submit" name="change" value="6th Button" id="b6"/>
</div>
</body>
Your code is working, as you can see in this FIDDLE
When your code execute this line, you will see the background getting bigger:
fm.style.height = '500px';
check whether the page has any other html element contains same id name "figmenu"
in a page there should not be two ids with a same name

Wiping out default text when user will enter a username [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to use JavaScript to wipe out default text and allow user to enter a his choice word. How do I integrate this thing with my HTML code. I need it for testing purpose. Below is my HTML code.
<html>
<body bgcolor="black"><form method="get" action ="http://localhost:2013">
<center>
<font color="white" size=65>Enter Word:
<input type="text" name="word"></font></center>
</br><center>
<font color="Green" size=65>
<input type="submit" value="SUBMIT"></font></center><
form>
</body>
</html>
Any suggestions?
<!DOCTYPE html>
<body bgcolor="black"><form method="get" action ="http://localhost:2013">
<center>
<font color="white" size=65>Enter Word:
<input type="text" name="word" placeholder='Default Text'></font></center>
</br><center>
<font color="Green" size=65>
<input type="submit" value="SUBMIT"></font></center><
form>
</body>
</html>
Just add placeholder='Default Text' to your input element.
No need of much items, this will help you...
<form action="demo_form">
<input type="text" name="fname" placeholder="Your default text"><br>
<input type="text" name="lname" placeholder="Your default text"><br>
</form>

Categories