Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 411 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change CSS property or remove Id from a class

#1
Both `div`s have the same class but I want to make the lower `div` be hidden and after clicking on first `div`'s button the second `div` becomes visible

techniques:

* on click add css property
* or remove hidden property
* or any other option if possible

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

function myfunction() {
document.getElementById('bb').style.cssText = 'visibility:visible';
}

<!-- language: lang-css -->

.ab {
width: 200px;
height: 200px;
background: black;
}

#bb {
visibility: hidden;
}

<!-- language: lang-html -->

<script src="test.js"></script>
<div class="ab">
<input type="Email" placeholder="Email" /><br/>
<input type="password" placeholder="password" /><br/>
<button type="submit" value="submit" id="btn">Submit</button></div>
<div class="ab" id="bb" onclick="myfunction()">
<p>
<font color="white">you have succesfully registered</font>
</p>
<button type="submit">Return</button>
</div>

<!-- end snippet -->


Reply

#2
Try this by adding a click event

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

<html>

<body>
<script src="test.js"></script>
<div class="ab">
<input type="Email" placeholder="Email" />
<br/>
<input type="password" placeholder="password" />
<br/>
<button type="submit" value="submit" id="btn" onclick="showLowerDiv()">Submit</button>
</div>
<div class="ab" id="bb" onclick="myfunction()">
<p><font color="white">you have succesfully registered</font></p>
<button type="submit">Return</button>
</div>
<style>
.ab {
width: 200px;
height: 200px;
background: black;
}

#bb {
visibility: hidden;
}
</style>
<script>
function myfunction() {
document.getElementById('bb').style.cssText = 'visibility:visible';
}

function showLowerDiv() {
document.getElementById('bb').style.visibility = 'visible';
}
</script>
</body>

</html>

<!-- end snippet -->

Reply

#3
Your `onclick="myfunction()"` should be on the first button, shouldn't it? And there are some minor mistakes/typos in the code, which I fixed in my snippet

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

function myfunction() {
document.getElementById('bb').style.cssText = 'visibility:visible';
};

<!-- language: lang-css -->

.ab {
width: 200px;
height: 200px;
background: black;
}

#bb {
visibility: hidden;
}

<!-- language: lang-html -->

<div class="ab" >
<input type="Email" placeholder="Email" /><br/>
<input type="password" placeholder="password" /><br/>
<button type="submit" value="submit" id="btn" onclick="myfunction()">Submit</button></div>
<div class="ab" id="bb" >
<p>
<font color="white">you have succesfully registered</font>
</p>
<button type="submit">Return</button>
</div>

<!-- end snippet -->

Reply

#4
If I understood correctly, you're looking to show the second div ('bb') after you click the submit button, then clicking the return button in the second div will hide it and return to the first one.

In that case, the HTML:

<div class="ab" id="ab">
<input type="Email" placeholder="Email"/><br/>
<input type="password" placeholder="password"/><br/>
<button type="button" value="submit" id="btn" onclick="submitForm();">Submit</button>
</div>

<div class="ab" id="bb">
<p><font color="white">you have succesfully registered</font></p>
<button type="button" onclick="returnToForm();">Return</button>
</div>

The CSS would be:

<style>
.ab {
width:200px;
height:200px;
background:black;
}
#bb{
display: none;
}
<style>
*Note: you need to close the `<style>` tag before opening a script tag.*

And finally the JS:

<script>
function submitForm()
{
$('#ab').hide();
$('#bb').show();
}
function returnToForm()
{
$('#ab').show();
$('#bb').hide();
}
</script>
Reply

#5
To make the 2nd `div` appear when the Submit button is clicked, move the `onclick="myfunction()"` to the Submit button.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

function myfunction() {
console.log('show')
document.getElementById('bb').style.visibility = 'visible';
}

<!-- language: lang-css -->

.ab {
width: 200px;
height: 200px;
background: black;
}

#bb {
visibility: hidden;
}

<!-- language: lang-html -->

<script src="test.js"></script>
<div class="ab">
<input type="Email" placeholder="Email" /><br/>
<input type="password" placeholder="password" /><br/>
<button type="submit" value="submit" id="btn" onclick="myfunction()">Submit</button></div>
<div class="ab" id="bb">
<p>
<font color="white">you have succesfully registered</font>
</p>
<button type="submit">Return</button>
</div>

<!-- end snippet -->

Reply

#6
If you want to display the second div on button click. Use the below code.

I have moved your `myfunction()` on the click event of first submit button.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

function myfunction(){
document.getElementById('bb').style.cssText ='visibility:visible';
}

<!-- language: lang-css -->

.ab{
width:200px;
height:200px;
background:black;
}
#bb{
visibility:hidden;
}

<!-- language: lang-html -->

<div class="ab">
<input type="Email" placeholder="Email"/><br/>
<input type="password" placeholder="password"/><br/>
<button type="submit" value="submit" id="btn" onclick="myfunction()">Submit</button>
</div>
<div class="ab" id="bb" >
<p>
<font color="white">you have succesfully registered</font>
</p>
<button type="submit" >Return</button></div>

<!-- end snippet -->

Reply

#7
See if this what u need ..



<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

function myfunction() {
document.getElementById("bb").style.display = "block";
}

<!-- language: lang-css -->

.ab {
width: 200px;
height: 200px;
background: black;
}

#bb {
display:none;
}

<!-- language: lang-html -->

<script src="test.js"></script>
<div class="ab">
<input type="Email" placeholder="Email" /><br/>
<input type="password" placeholder="password" /><br/>
<button type="submit" value="submit" id="btn" onclick="myfunction()">Submit</button></div>
<div class="ab" id="bb" >
<p>
<font color="white">you have succesfully registered</font>
</p>
<button type="submit">Return</button>
</div>

<!-- end snippet -->

Reply

#8
Try this code...


<html>
<body>
<script src="test.js"></script>
<div class="ab">
<input type="Email" placeholder="Email"/><br/>
<input type="password" placeholder="password"/><br/>
<button type="submit" value="submit" id="btn" onclick="myFunction()">Submit</button></div>
<div class="ab" id="bb" >
<p><font color="white">you have succesfully registered</font></p>
<button type="submit" >Return</button></div>
<style>
.ab{
height:200px;
background:black;
}
#bb{
visibility:hidden;
}
</style>
<script>
function myFunction() {
document.getElementById('bb').style.cssText ='visibility:visible';
console.log("dfvgds");
}</script>

</body>
</html>
Reply

#9
In jquery you can do like this:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

$(function(){
$('#btn').on('click',function(){
$('#bb').show();
});
});

<!-- language: lang-css -->

.ab{
width:200px;
height:200px;
background:black;
}
#bb{
display:none;
}

<!-- language: lang-html -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<input type="Email" placeholder="Email"/><br/>
<input type="password" placeholder="password"/><br/>
<button type="submit" value="submit" id="btn">Submit</button></div>
<div class="ab" id="bb">
<p><font color="white">you have succesfully registered</font></p>
<button type="submit" >Return</button>
</div>

<!-- end snippet -->

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through