logo
down
shadow

How to hide an element and only show it when a user starts typing?


How to hide an element and only show it when a user starts typing?

Content Index :

How to hide an element and only show it when a user starts typing?
Tag : html , By : Mighty Mac
Date : November 27 2020, 12:01 PM

wish help you to fix your issue I am trying to incorporate a search function into my Jekyll site. I therefor decided to go with with Simple-Jekyll-Search which can be found here: Link. , Hide card class in your stylesheet first.
.card{

display:none;
}
$(function() {
     $('#my-search-input').keyup(function() {
 if ($(this).val().length == 0) {

    $('.card').hide();
  } else {
    $('.card').show();
  }
}).keyup();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

TextField - show hint before user starts typing text


Tag : blackberry , By : ArmHead
Date : March 29 2020, 07:55 AM
With these it helps I am developing an Blackberry application. I want to show a hint text in TextField before user starts typing.when user starts typing it should disappear and when there are 0 characters in TextField it should show up.Has anybody implemented this yet?then please share. , here is the implementation within paint() method
String test = super.getText();
        if ( test == null || test.length() < 1 ) {
            graphics.setColor( 0x00a0a0a0 );
            graphics.drawText(hint, 0, 0);
        }

How to show Search charm when user starts typing in windows 8 app (html & js)


Tag : development , By : user176691
Date : March 29 2020, 07:55 AM
wish of those help Building a Win8 app using JS and Html. How can I have the Search charm appear as soon as the user starts typing when my app is open? I have the following code in default.js, just before app.addEventListener("activated", function (args) {: , This retrieves the setting value:
var showOnKeyboardInput = searchPane.showOnKeyboardInput;
searchPane.showOnKeyboardInput = showOnKeyboardInput;
searchPane.showOnKeyboardInput = true;

Show element if user starts typing


Tag : jquery , By : lietkynes
Date : March 29 2020, 07:55 AM
wish of those help I am trying to show an element when the following criteria has been met: 1. The input is in focus 2. The input has 1 or more characters. , You can use input event instead of click event and focus selector:
$('input').on('input', function(){
    if ($(this).val().length > 1) {
		$(this).siblings('.show').fadeIn();
	} else {
          $(this).siblings('.show').fadeOut();
    }
});
			
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}


body {
	font-family: sans-serif;
	font-size: 16px;
	color: #5c5c5c;
	line-height: 22px;
}

main {
	max-width: 600px;
	margin: 20px auto;
	padding: 16px;
}

.group {
	margin-bottom: 16px;
	position: relative;
}

label {
	color: #393939;
	display: block;
	margin-bottom: 8px;
	font-weight: bold;
}

input,
textarea {
	font-family: sans-serif;
	font-size: 16px;
	color: #5c5c5c;
	border-radius: 2px;
	border: 1px solid #ccc;
	width: 100%;
	padding: 12px;
	margin-bottom: 4px;
	-webkit-appearance: none;
	outline: none;	
	transition: all 0.4s ease;
}

input:not(textarea){
	height: 48px;
}

input:focus,
textarea:focus {
	box-shadow: inset 0 0 0 2px rgba(74, 168, 81, 1);
}

::placeholder {
	font-family: sans-serif;
	color: #bbb;
}

.hint {
	font-size: 14px;
	line-height: 20px;
	color: #727272;
	position: relative;
	top: -5px;
	opacity: 0;
	z-index: -1;
	transition: all 0.2s ease;
}

input:focus + .hint {
	opacity: 1;
	top: 0;
}

.show {
	font-size: 14px;
	line-height: 20px;
	display: none;
	position: absolute;
    top: 44px;
    right: 14px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<main>
  <div class="group">
		<label for="email">Email</label>
	    <input type="text" id="email" placeholder="e.g. jamesgreen@gmail.com">
	</div>

	<div class="group">
		<label for="password">Password</label>
	    <input type="password" id="password">
	    <p class="hint">Password must have at least 8 characters, a lower case letter, an uppercase letter and a number</p>
	    <span class="show">SHOW</span>
	</div>
</main>

Hide datalist options when user starts typing


Tag : javascript , By : sam
Date : March 29 2020, 07:55 AM
I hope this helps you . One way you can do this is to chage the datalist id when there is a value in input. If there is no value then change the id back so that they can choose the options in the datalist rather than type a new one.
function hideList(input) {
	var datalist = document.querySelector("datalist");
	if (input.value) {
		datalist.id = "";    		
	} else {
		datalist.id = "talk-list";
	}
}
<input id ="userText" name="userText" type="text" list = 'talk-list' oninput="hideList(this)"></input>
    <span class = "dropdown" title = "Saved Talk"><datalist id = 'talk-list'><option>Apple</option><option>Ball</option><option>Calculator</option><option>Donkey</option></datalist></span>
    <button id="speakText" class="toolbutton" title="Speak">Speak</button>

Is there a way to hide a UILabel when the user starts typing, and then make it re-appear if the user removes all input?


Tag : ios , By : Paul Schwarz
Date : March 29 2020, 07:55 AM
it fixes the issue You Can do it using add a target to your textFiled with a selector like this
add this target to ur viewDidLoad method
yourTextFiled.addTarget(self, action: #selector(self.textFieldDidChange(_:)), for: UIControl.Event.editingChanged)
    @objc func textFieldDidChange(_ textField: UITextField) {
        if textField.text!.isEmpty {
            label.isHidden = false
        } else {
            label.isHidden = true
        }
    }
Related Posts Related QUESTIONS :
  • Unable to display 3 columns in same row in printed page using bootstrap
  • How to achieve selection of radio element on click of label
  • Heading elements appearing below content
  • How do I position a side section or div in relation to nav bar?
  • How to maintain button location regardless of image size
  • How do I position the icon to the right of the heading?
  • Ionic 3 CPF/CNPJ mask
  • Flex Layout not following flex percentages
  • Some images not working in `background-image:url()`
  • How to add an icon preview to a html list of google store apps?
  • How to hide element overflow without cropping inline images/text?
  • Margin-Top is not working for me when attempting to adjust the location of a button
  • When I send a letter to the mail gives an error 'tuple' object has no attribute 'get'
  • How can i intentionally access the "Index of /" page on my local server?
  • Unable to position a image and text side by side using css/html
  • Text not re-displaying on click of button
  • How to use href attribute in a link tag accurately in android?
  • Repeated reference of classes causing text margins to shift
  • Are my home and about links hyperlinking to the right pages?
  • Tinted background image not working with Bootstrap
  • How can I stop my parallax div having a blurred background?
  • CSS hover effect to modify another element is not working
  • why section-testimonial is not placing correctly
  • Why doesn't my media screen query work, I can't make my website responsive?
  • Aligning inline-block elements horizontally
  • How do I display TypeScript code in "<code>" tags in an Angular app?
  • How can I change the color of input tag in a form when focusing on it?
  • How do I put a container in a fixed position with its own overflow?
  • How to fix text-alignment
  • Outlook not displaying a portion of HTML
  • Remove radio button text only with CSS
  • How to use "v-if" in Vue.js to render a <span> only if parent div has a specific property?
  • How to Extract just the Date from Angular Material Datepicker
  • @keyframes not working, I have tried everything i can think of
  • Bootstrap fix form to bottom of the page
  • How to hide a list element in html
  • How to stop repeating image
  • How do I prevent the GET method from encoding HTML special characters in the URI?
  • CSS/HTML: How do I change the color of the check mark within the checkbox input?
  • attaching a file path in a html form
  • Flip <canvas> (rotate 180deg) after being published on page
  • Is there an application I can show a client the speed of their site via differring internet connections?
  • Html / Email / Distribution list problem from a noob
  • Inspiring web experiments and technical demos
  • Can I load javascript code using <link> tag?
  • Lisp-style quotation in HTML
  • How to put text float around image like some newspapers' format using CSS?
  • Technical reasons for not having large background images in websites
  • HTML 5 Structure tags demo
  • Angular - String interpolation of undefined variable
  • Is there any way to edit specific Column of table using mat-table in Angular material
  • How can I set a text as a shadow for a heading element?
  • How to fix the forms making the buttons overlap
  • Splitting XML into multiple HTML pages with XSLT?
  • How to justify empty divs in flex container
  • How to blur in CSS only one layer of when you have multiple layers in background-image?
  • Scrollable html table with fixed first row and first column, along with angular material controls within the cells of ta
  • In Django, how to extract ID attribute from html Input tag, WITHOUT using django forms
  • how to fix link tag in html after changing css
  • How do I add a top padding to the second row?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com