Click here to Skip to main content
15,843,727 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i don't know how to convert like 

getElementById

 document.getElementById("cnt").innerHTML += "select: " +numberOfAttribute+". By javascript<br>";


function javascript_click() {
if (document.getElementById("value3").value && document.getElementById("value4").value ) {
var attName=document.getElementById("value3").value;
var attValue=document.getElementById("value4").value;
var total_name_and_value = "[" + attName + "=" + attValue + "]";
var numberOfAttribute = document.querySelectorAll(total_name_and_value).length;
document.getElementById("cnt").innerHTML += "select: " +numberOfAttribute+". By javascript
";

}

if(document.getElementById("value1").value=='' && document.getElementById("value2").value=='' && document.getElementById("value3").value=='' && document.getElementById("value4").value=='')
{
document.getElementById("cnt").innerHTML += "wrong.
";
}
}

What I have tried:

$("value3").value;

i tried like this and it didn't work..
Posted
Updated 7-Oct-18 0:13am
v2
Comments
Richard Deeming 9-Oct-18 13:16pm    
A strange time to be doing that - most people are going the other way, trying to drop jQuery and replace it with plain Javascript.

1 solution

If you in the process of updating your code to use jQuery it will be a good thing to grab a link to the documentation and consult it from time to time...
In vanila JS you have value, but under jQuery it is val only:
.val() | jQuery API Documentation[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900